0
'HELLO'를 5 번 누르면 빨간색으로 바뀌려고합니다. 실용적인 것을 추가 할 때 아무 것도 추가하지 않습니다. 이것은 코드입니다.python에서 GUI를 사용하여 변수를 사용하는 방법 3
from tkinter import *
class application(Frame):
global t
t=1
def info(self):
print ("test")
global t
t=t+5
def createWidgets(self):
global t
t=t
self.exet= Button(self)
self.exet["text"] = "QUIT"
self.exet["fg"] = "red"
self.exet["command"] = self.quit
self.exet.pack({"side": "left"})
self.hi = Button(self)
self.hi["text"] = "HELLO",
if t == 5:
self.hi["fg"] = "red"
self.hi["command"] = self.info
self.hi.pack({"side": "left"})
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
누구에게 감사합니다!
들여 쓰기가 모두 끝났습니다. 청소 해 주실 수 있습니까? –