Python - Tkinter window says (not responding) but code is running
Python is an interpreted, object-oriented, high-level programming language. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development.
I have a program that runs a long process after you click an action button. As the process is running the root window will say that it is not responding even though I know the program is running in the background. This program is going to be released to a few people that I work with and I want to make sure they don't freak out and close the window when they see this. The solution I have is sitting a root.update in the loop of the process that is running but I am not sure this was the best fix.
Using the python 3.3
Here is a sample of the code so you get an idea of what I am doing, this is called from the main loop:
def combine(boxes_to, boxes_from, frame): to_value,to_pos = gui.checkBoxes(boxes_to) from_value,from_pos = gui.checkBoxes(boxes_from) frame.destroy() running = Label(root,text="Running please do not close..",font = (16)) running.pack() root.update() map_to = open("map_to",'r') for line in map_to: root.update() process(line) running.destroy() map_to.close() finish = Button(root, text="Done",command=gui.stop) finish.pack()
There are 2 suggested solutions here and each one has been listed below with a detailed description. The following topics have been covered briefly such as Python, User Interface, Tkinter, Python 3.x. These have been categorized in sections for a clear and precise explanation.
These were some of the most noted solutions users voted for. Kindly upvote the solution that was helpful for you and help others.