Reputation: 1536
If i run it it will open the blue window but destroy()
will not close the window. How can i fix it with a commant that closes it?
Internet resources point to the destroy()
comand which doesnt function.
Although i know that mainloop
keeps the window alive when i try to exit it using destroy
it just doesn't work.
from tkinter import *
import time
my_window = Tk()
my_window.title('Lang')
my_window.configure(background= 'blue')
#time.sleep(1)
my_window.mainloop()
my_window.withdraw()
my_window.destroy()
Upvotes: 0
Views: 840
Reputation:
You need to put the mainloop at the end of your code.
from tkinter import *
import time
my_window = Tk()
my_window.title('Lang')
my_window.configure(background= 'blue')
#time.sleep(1)
my_window.withdraw()
my_window.destroy()
my_window.mainloop()
Upvotes: 1