I have been googling for hours on “PyQt5 update text on screen” but I am completely stuck because I can’t understand the logic of PyQt5.
- All I want is a simple window with text on it that I can update.
- I am not interested in diving deep into all of the different functions that PyQt5 has.
I have a program which displays a window with a text on the screen using the following:
def __init__(self) -> None:
self.app = QApplication(sys.argv)
self.main_window = MainWindow()
self.main_window.move(2350, 360)
self.textBox = QtWidgets.QLabel(self.main_window)
def RunWindow(self):
self.textBox.setText("input")
self.main_window.show()
self.app.exec_()
The problem is that I can’t update the text because of this:
(1) No window will appear until the syntax “app.exec_()” is run.
(2) When the line “app.exec_()” runs, it blocks any other code that follows it.
This means that when i try to run a function which updates the text, the code never reaches the function, and I am stuck with the same text as when the program started.