I have created a GUI using Tkinter. The GUI is supposed to open a file and read the content. However, if the file content is really big and if certain task takes up a lot of time, it would require a loading screen to let user know it is loading.
This loading screen should also get all the focus and not allow user to click on anything else on the GUI until task is complete. How can I do this?
The following is a simple example of my code. It would be great if I can get a modified version of the code back:
from Tkinter import Tk, Frame, BOTH, Menu
class Application(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.geometry('%dx%d+%d+%d' % (800, 300, 0, 0))
self.parent.resizable(0, 0)
menubar = Menu(self.parent)
self.parent.config(menu = menubar)
self.fileMenu = Menu(menubar, tearoff = 0)
self.fileMenu.add_command(label = "Open", accelerator = "Ctrl+O", command = self.onOpen)
menubar.add_cascade(label = "File", menu = self.fileMenu)
self.pack(fill = BOTH, expand = True)
def onOpen(self):
pass
def main():
root = Tk()
Application(root)
root.mainloop()
if __name__ == '__main__':
main()