Is there any way to create a loading screen in tkinter?
Here's the code:
from tkinter import *
root = Tk()
text = Text(root , width = 65 , height = 20 , font = "consolas 14")
text.pack()
text.insert('1.0' , "hello\n"*5000000)
mainloop()
Here, the main window takes some time to pop up, so I would like to create a temporary window that tells the user that some process is going on.
To do this, I did something like this:
from tkinter import *
root = Tk()
temp_win = Toplevel()
message_label = Label(temp_win , text = "Loading.. Please wait")
message_label.pack()
text = Text(root , width = 65 , height = 20 , font = "consolas 14")
text.pack()
text.insert('1.0' , "hello\n"*5000000)
mainloop()
But here, both the windows only pop up only when the mainloop
function is called, which is of no use.
My goal is to show the temporary window before the main window pops up.
Is there any way to achieve this in tkinter?
It would be great if anyone could help me out.