'Python PyQt update GUI
basically I am having trouble with Updating my new GUI. Windows 10 | Python 3.8 | PyQt5
I got a class like
class My_GUI():
def __init__(self):
...
def callback_func1(self):
self.tabWidget.setCurrentWidget(self.tabWidget.findChild(QWidget, "tab_2"))
func2() # does some file operations in the background
self.tabWidget.setCurrentWidget(self.tabWidget.findChild(QWidget, "tab_1"))
That callback_func1 is connected to a QPushbutton.clicked - Signal, so i push the button and it is running.
And here is my problem: I would like to first switch the tab in the GUI to tab2, then call func2 (which is not a class method and not using the object ) and then switch to tab1.
But what happens visually is: I just see the switching to tab1 in the end (after func2 needed its 2 minutes to run). So the first tab change never happens.
I think the problem is that the windows shows changes just after the object was returned from the callback function
--> How would you solve this? Is there only the option to do something like Multithreading?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|