command = window.destroy doesn't work
command = window.destroy doesn't work
from tkinter import *
window = Tk()
b1=Button(window, text="close", command=window.destroy)
b1.grid(row=0,column=0)
window.mainloop()
In this code, when I execute and push a button of window "close", the window never close, infinite loading, until I task kill it.
No error happens. Could you explain what happened or Is there another way to close a window?
otherwise, this is my hardware problem?
I am using:
Macbook air 2012 model
python 3.6.6
jupyter lab
Thank you!
python3 a_file_with_that_code.py
works fine for me, can you provide a screenshot of what you are getting?
– James Lingham
Jul 3 at 7:05
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
This works fine (i.e. I can click the button to close the window) on my Mac, Python 3.6.x command line (
python3 a_file_with_that_code.py
). What do you mean with "infinite loading"?– AKX
Jul 3 at 6:56