例如,我有一个变量:x =1。我想使用tkinter按钮将其更改为x = 2。
我尝试过:
b1 = Button(root,bg = "black",fg = "white",text = "idk",command = (x=2))
U可以在命令上调用函数来设置全局变量