我正在嘗試運(yùn)行一個(gè) while 循環(huán)來更改我的代碼中的變量,但它只會(huì)破壞我的代碼。我不知道該怎么做。當(dāng)我改變 T 而不重復(fù)命令時(shí),我希望 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中
添加回答
舉報(bào)
0/150
提交
取消