我有一个最小的tkinter程序来分析一些数据。有些数据文件非常大,因此为了确保GUI保持响应,我将数据加载到一个新线程中。
线程终止后,如何对数据进行分析?
下面是一些示例代码。
import tkinter
from threading import Thread
from time import sleep
result = []
def func(result):
sleep(10)
ans = 1
result.append(ans)
class myApp(tkinter.Tk):
def __init__(self, parent):
我想创建一个按钮,我可以disable和re-enable,只要我点击它。使用下面的代码,我得到了一个可以disable的按钮,但当我单击它时它不会re-enable。如果看了这个威胁,但它没有帮助:
import tkinter
from tkinter import *
# toplevel widget of Tk which represents mostly the main window of an application
root = tkinter.Tk()
root.geometry('1800x600')
root.title('Roll Dice
我一直在使用Python2.7中的Tkinter开发一个文本编辑器。我正在尝试实现的一个功能是夜间模式,用户可以在黑色背景和浅色背景之间切换,只需单击切换按钮就可以从浅色切换到深色。
from Tkinter import *
from tkSimpleDialog import askstring
from tkFileDialog import asksaveasfilename
from tkFileDialog import askopenfilename
from tkMessageBox import askokcancel
Window = Tk()
Window.
目前,我正在从事一个项目,这是一个从英语到摩尔斯电码的翻译。我现在正在使用Tkinter来设置GUI。当我打开并运行GUI时,我可以在框中输入文本并使用clear按钮将其清除-但convert按钮将不起作用,该按钮应该从顶部文本框中提取文本并将其转换/加密到底部文本框中。我不确定如何解决我的问题。这个文件还从一个单独的文件中获取另一个类,该文件只包含转换的字典。 import tkinter
from MorseCodeTranslator.MorseCode import MorseCode as mc
class MorseCodeGUI(tkinter.Frame):
de
到目前为止,我的代码是:
import tkinter
def hello():
a = tkinter.Button(text ="what is this", padx = 10, pady = 10)
a.pack()
c = tkinter.Button(text ="what do you want", padx = 10, pady = 10)
c.pack()
b = tkinter.Button(text = "Welcome to the interface. click to get started