Trying to send 2 signals to different methods when button clicked and start in parallel
-
So, the problem is that I am trying to include a progress bar in my code, like this: https://pythonpyqt.com/pyqt-progressbar/ so when I press a button to my main window as the processing takes place, in parallel a progress bar opeerates. I tried the code from the below links:
- https://stackoverflow.com/questions/32285370/python-calling-two-functions-by-clicking-one-button-in-pyqt/32285438
- https://stackoverflow.com/questions/24544189/how-to-invoke-two-functions-when-a-button-is-clicked
when I attach 2 different methods the one above the other, the problem is that the 1st method finishes and then the second method that includes the progress bar starts. As you can understand this concept cannot work. Also I tried to include the 2 methods to one method and trigger that one method when the button is pressed. Again it does not work correctly. I have read in the above links something about thread programming, but I have no idea where to start... Any ideas? Is thread programming the only way ? If yes, where should I start?
-
So, the problem is that I am trying to include a progress bar in my code, like this: https://pythonpyqt.com/pyqt-progressbar/ so when I press a button to my main window as the processing takes place, in parallel a progress bar opeerates. I tried the code from the below links:
- https://stackoverflow.com/questions/32285370/python-calling-two-functions-by-clicking-one-button-in-pyqt/32285438
- https://stackoverflow.com/questions/24544189/how-to-invoke-two-functions-when-a-button-is-clicked
when I attach 2 different methods the one above the other, the problem is that the 1st method finishes and then the second method that includes the progress bar starts. As you can understand this concept cannot work. Also I tried to include the 2 methods to one method and trigger that one method when the button is pressed. Again it does not work correctly. I have read in the above links something about thread programming, but I have no idea where to start... Any ideas? Is thread programming the only way ? If yes, where should I start?
@john_hobbyist said in Trying to send 2 signals to different methods when button clicked and start in parallel:
Any ideas?
https://doc.qt.io/qt-5/thread-basics.html
"Any ideas? Is thread programming the only way ?" - could be. It is not really clear what you are doing. If you have long lasting task and don't want to block main thread, then yes, threads are the way to go.