简体   繁体   中英

Qt freezing cause of the loop?

I have designed a gui with PYQT4. It has two buttons. One of start button. It starts a start.py file. And another button execute stop.py file that stop start.py pid.

This start.py and stop.py files are on a remote location. I am connecting there with ssh and paramiko.

When I click to start button, gui is freezing and never answering. I can only get rid of the situation by closing the program . I know the problem. Because there is a while loop in start.py and it never ends.

When i click to start button its wait for the while loop.

I want to run start.py and i dont want to wait for the loop. It must be run in background or etc..

What can i do ? I tried to trigger it with another .py file. I used subprocess method. But no success. Still have same problem.

Have a look at PyQT theading . You can also use asyncio if you are using python3.

I found the solution. I covered that function in thread. And now its working properly without freeze or lag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM