python - How can open new tkinter window by threading? -


i want open splash window using threading , show loading files page. write simple code open new window , close after 1 second:

import tkinter  tk threading import thread thread import time  class t():       def det(self):         self.x = tk.tk()         self.x.mainloop()     def det2(self):         self.x.destroy()  k = t() ts = thread(target=k.det, args=()) ts.start() time.sleep(1) k.det2() 

when try run, steps ok code never finished! in self.x.destroy() hanged. why happed?

for simple don't need threading, use after function:

import tkinter tk root = tk.tk() root.after(1000, root.destroy) root.mainloop() 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -