I have created a working GUI interface using Tkinter, Python. It takes a minuet or two to load the GUI, my question is the following:
Is there away to display an image while python is performing the load on the GUI?
Really appreciate the help.
I have created a working GUI interface using Tkinter, Python. It takes a minuet or two to load the GUI, my question is the following:
Is there away to display an image while python is performing the load on the GUI?
Really appreciate the help.
As suggested in the comments you can use a TopLevel to display another window.
You can use <NameOfYourTopLevel>.overrideredirect(1)
to hide the window frame.
You might also consider using .after_idle(<callback>)
to close the window once the GUI has completed loading.
Here is more complete example. I haven't been able to replicate the large delay in drawing the GUI so have simulated this with self.after(5000,self.splash.destroy)
. You should be able to replace this with self.after_idle(self.splash.destroy)
try:
import tkinter as tk
except:
import Tkinter as tk
class App(tk.Frame):
def __init__(self,master=None,**kw):
self.splash = Splash(root)
tk.Frame.__init__(self,master=master,**kw)
tk.Label(self,text="MainFrame").grid()
self.after(5000,self.splash.destroy)
class Splash(tk.Toplevel):
def __init__(self,master=None,**kw):
tk.Toplevel.__init__(self,master=master,**kw)
tk.Label(self,text="Show Image here").grid()
self.overrideredirect(1)
if __name__ == '__main__':
root = tk.Tk()
App(root).grid()
root.mainloop()
This question will tell you how to centre the window in your screen.