GUI and functions/loops. Avoid freeze? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

GUI and functions/loops. Avoid freeze?

I have made a GUI with an start and stop button. The start button will start mutliple functions after eachother. Some of the functions contain loops, some dont. When the start button is pressed the GUI freeze. Whats the best and common way to avoid it?

30th Jan 2017, 7:47 AM
Andre
2 Answers
+ 1
You are probably doing work on the main thread, the same message loop as the gui works in, to solve this in other languages like c# you would create a background thread / worker, i'm not really a python fan but i'm sure that's how it would work there as well :). Here's some resources that might help https://wiki.wxpython.org/Non-Blocking%20Gui https://www.tutorialspoint.com/python/python_multithreading.htm
30th Jan 2017, 8:20 AM
Alex
Alex - avatar
+ 1
You need firstly to be sure that you don't have an infinite loop or another(s) mistake(s) which could be the origin of the freeze ^^ Post your code or a link to it, if you want further help for debuging/searching a solution ;)
31st Jan 2017, 9:34 AM
visph
visph - avatar