我试图弄清楚如何在Tkinter中按下按钮之前暂停代码执行。我找到了键盘输入的例子,但是想方设法用按钮做同样的事情。
提前致谢!
答案 0 :(得分:0)
可能是这样的:
from tkinter import *
root = Tk()
def mainfunction():
#stuff your program is supposed to do
runmain = False
def runtheprogram():
runmain = True
b1 = Button(root, text="Start", command=runtheprogram)
b1.pack()
if runmain:
mainfunction()
root.mainloop()