dimanche 25 janvier 2015

Tkinter button command activates when program is run


Vote count:

0




Found a similar thread here: Tkinter button command activates upon running program?


However I couldn't fully understand the answer being a relatively new.



def Destroy(var):
var.destroy()


Is the function I wish too call.



exit_button = tk.Button(master, text = "Exit", command = Destroy(master))


However when I run the program, it instantly closes with the error message:



_tkinter.TclError: can't invoke "button" command: application has been destroyed


What I want is for the program to exit once the button is pressed, and I will be using the same function to destroy other widgets etc so it needs to be a function.


Will clarify more if needed.



asked 22 secs ago







Tkinter button command activates when program is run

Aucun commentaire:

Enregistrer un commentaire