so I'm trying to make a progress bar that automatically starts filling whenthe window is opened..so instead of making a button that when pressed it call the function of fillingthe bar I call the function directly, and unexpectedly for me it shows an emptywindow and after 5 sec (the time to fill the bar) the bar shows filledthe thing is that when I replaced the fill() with a button it works properlyso why isn't it working just by calling the function and how to make it fillwithout a buttonmy code:
from tkinter import *from tkinter import ttk as ttkfrom time import *def fill(): t = 100 x = 0 s = 1 while x <= t: bar['value'] += s x += s sleep(0.05) window2.update_idletasks()def read(): global window2 window2 = Tk() global bar bar = ttk.Progressbar(window2,orient=HORIZONTAL,length=300) bar.pack(pady=15) fill() # here I replace the function with a button calling it and it works well but I don't want a button window2.mainloop()read()