Answer the question
In order to leave comments, you need to log in
How to properly use a timer in PyQt?
Hello!
why is this code not working???? How do I ************** with this pyqt .......................
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import*
import sys
app = QApplication(sys.argv)
def tick():
print('Hello World')
timer = QTimer()
timer.timeout.connect(tick)
timer.start(1000)
timer.stop()
sys.exit(app.exec())
Answer the question
In order to leave comments, you need to log in
Your code does exactly what you wrote.
timer.start(1000) - starts the timer
timer.stop() - stops the timer. What does it have to do with it in our case even before the actual start of the timer. app.exec() hasn't even started yet.
What actions do you expect from him if you stopped him???
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question