tkinter

Digital clock in status bar in python 3 and tkinter

若如初见. 提交于 2021-02-07 10:49:20
问题 I want to put this digital clock: import sys from tkinter import * import time root = Tk() time1 = '' clock = Label(root, font=('times', 20, 'bold'), bg='green') clock.pack(fill=BOTH, expand=1) def tick(): global time1 # get the current local time from the PC time2 = time.strftime('%H:%M:%S') # if time string has changed, update it if time2 != time1: time1 = time2 clock.config(text=time2) # calls itself every 200 milliseconds # to update the time display as needed # could use >200 ms, but

Using Queue with tkinter (threading, Python 3)

心不动则不痛 提交于 2021-02-07 10:47:55
问题 I have a script in Python 3 and I'm trying to make a GUI for it using tkinter. Here is a complete example of working code: #!/usr/bin/python # coding: utf-8 import pickle import openpyxl from tkinter import * import threading import queue class Worker(): def __init__(self): self.one_name_list = [] self.dic = {} self.root = Tk() self.root.title("GUI Python") self.root.geometry("820x350") self.thread_queue = queue.Queue() self.btn1 = Button(text="start counting", width = '20', height = '1',

How to capture the output of a long-running program and present it in a GUI in Python?

試著忘記壹切 提交于 2021-02-07 10:42:21
问题 I'll try to be much clear as possible. I have a very simple test script that control a Power Supply, the script measure some current from the Agilent Power Supply + Unit Under Test, then, the script print these readings as simple as: PS.write(b"MEAS:CURR? \n") time.sleep(2) response = PS.read(1000) time.sleep(3) print(response) (float(response)*1) E3632A=(float(response)*1) print (E3632A) When the script excecute the "print command" (print (E3632A), all the information is displayed into the

About tkinter StringVar()

纵然是瞬间 提交于 2021-02-07 10:31:45
问题 i am having issue with the tkinter StrinVar() and i dont have much knowledge in tkinter and would like some help, thanks. What i have done is i created two window in which each has a Entry widget and Button widget if you click button of one window then that window gets withdraw and another window pop ups and if you click button in that pop up window then it withdraws and a original window gets pop up.Here is the code:- from tkinter import * def x(): a1.set("") a.withdraw() b.deiconify() def y

About tkinter StringVar()

佐手、 提交于 2021-02-07 10:31:37
问题 i am having issue with the tkinter StrinVar() and i dont have much knowledge in tkinter and would like some help, thanks. What i have done is i created two window in which each has a Entry widget and Button widget if you click button of one window then that window gets withdraw and another window pop ups and if you click button in that pop up window then it withdraws and a original window gets pop up.Here is the code:- from tkinter import * def x(): a1.set("") a.withdraw() b.deiconify() def y

Opening a plot in tkinter only (no matplotlib popup)

孤者浪人 提交于 2021-02-07 10:24:42
问题 I am opening a matplotlib pyplot in a tkinter window with the below code. My issue is that the plot is still popping up in the matplotlib window as well, and I don't know how to stop that. I've tried commenting out each of the plt.plot's but that didn't help. import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib

Opening a plot in tkinter only (no matplotlib popup)

為{幸葍}努か 提交于 2021-02-07 10:23:32
问题 I am opening a matplotlib pyplot in a tkinter window with the below code. My issue is that the plot is still popping up in the matplotlib window as well, and I don't know how to stop that. I've tried commenting out each of the plt.plot's but that didn't help. import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib

Write to terminal in Tkinter GUI

别说谁变了你拦得住时间么 提交于 2021-02-07 10:14:55
问题 I am trying to show the changes in the command line in real time in my Tkinter GUI, I managed to create the GUI and integrate the terminal into it, but I cant bind the buttons with the terminal, my code is : import Tkinter from Tkinter import * import subprocess import os from os import system as cmd WINDOW_SIZE = "600x400" top = Tkinter.Tk() top.geometry(WINDOW_SIZE) def helloCallBack(): print "Below is the output from the shell script in terminal" subprocess.call('perl /projects/tfs/users/

Write to terminal in Tkinter GUI

[亡魂溺海] 提交于 2021-02-07 10:11:02
问题 I am trying to show the changes in the command line in real time in my Tkinter GUI, I managed to create the GUI and integrate the terminal into it, but I cant bind the buttons with the terminal, my code is : import Tkinter from Tkinter import * import subprocess import os from os import system as cmd WINDOW_SIZE = "600x400" top = Tkinter.Tk() top.geometry(WINDOW_SIZE) def helloCallBack(): print "Below is the output from the shell script in terminal" subprocess.call('perl /projects/tfs/users/

ttk creating and using a custom theme

ⅰ亾dé卋堺 提交于 2021-02-07 09:48:58
问题 I am trying to incorporate a customizable theme choice in my program. I have been referring to this guide: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-themes.html, but I am lost. Here is a sample code I have been using to try to figure this out. I created a new theme, "Shadow," correctly, but the next part I'm struggling with. Let's just keep it simple and say within the "Shadow" theme I would like to change the frame background to black, the button background to navy and the button