I have this PySide app and I want to run the function pp every 1 second, but when I run the app it only ran for 1 time.
import sys from PySide6.QtWidgets import QMainWindow, QApplication from PySide6 import QTimer class MainWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) ### self.timer = QTimer() self.timer.timeout.connect(self.pp()) self.timer.start(1000) print(self.timer.isActive()) def pp(self): print("LOL") if __name__ == "__main__": app = QApplication(sys.argv) window = MainWindow() window.show() #app.show() sys.exit(app.exec()) The console outputs:
LOL True I searched in the Qt documentation but found nothing
self.timer.timeout.connect(self.pp)