I know there are better ways about this, but I cant figure out what's wrong about this code, or at least, why it wont function the way I want it. Currently I made a simple test program to try my concept away from my main code.
from tkinter import *
root = Tk()
test = True
def click():
global test
print("working")
test = False
button = Button(root, text="Hi", command=click)
if test:
button.pack()
root.mainloop()
Everything runs fine but when I press the button all I get is the message "working" without the button going away.
Aucun commentaire:
Enregistrer un commentaire