Wanted to make a loading screen, no threads involved, just a class with init and 1 function. when I try to run it however it DOES WORK, just when i put my mouse on it or just wait long enough it says its 'unresponsive' and crashes.
Any ideas why?
Code:
class Loading_Screen:
def __init__(self):
self.root = Tk()
self.root.title('Waiting for Connection...')
self.root.config(bg = '#1F2700')
self.root.geometry('800x400')
theme = ttk.Style()
theme.theme_use('winnative')
theme.configure('orange.Horizontal.TProgressBar', background ='orange')
loading_txt = Label(self.root, text = 'Waiting for Connection...', font = 'Teko 15', bg = '#1F2700')
loading_txt.place(x=200, y =145)
self.PBar = ttk.Progressbar(self.root,
orient = 'horizontal', mode = 'indeterminate', length = 300)
self.PBar.place(x=200, y=180)
self.root.update()
self.PBar_animation()
self.root.mainloop()
def PBar_animation(self):
for i in range(0,2000):
self.PBar['value'] +=1
self.root.update_idletasks()
sleep(0.1)
self.root.destroy()
exit(0)