我正在尝试运行一个 while 循环来更改我的代码中的变量,但它只会破坏我的代码。我不知道该怎么做。当我改变 T 而不重复命令时,我希望 X 改变。import tkinterfrom tkinter import *code = Tk()T = 1X = 0def printx(): global X print(X);def teez(): global T T = 0;def teeo(): global T T = 1;while T == 1: X = 5else: X = 6button1 = Button(code, text = "Print X", command = printx)button1.pack()button2 = Button(code, text = "T = 0", command = teez)button2.pack()button2 = Button(code, text = "T = 1", command = teeo)button2.pack()code.mainloop()PS它在python 3.7中
添加回答
举报
0/150
提交
取消