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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -