📜  如何等到在 tkinter 中按下按钮 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:38.875000             🧑  作者: Mango

代码示例1
import tkinter as tk
root = tk.Tk()
...
var = tk.IntVar()
button = tk.Button(root, text="Click Me", command=lambda: var.set(1))
button.place(relx=.5, rely=.5, anchor="c")

print("waiting...")
button.wait_variable(var)
print("done waiting.")