PyQt4 - creating a timer
Solution 1:
Use new style signals, they are easier to understand.
Swap -
QtCore.QTimer.connect(timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("func()"))
With -
timer.timeout.connect(self.move_towards) # assuming that move_towards is the handler
A simple but full example of a working timer -
import sys
from PyQt4.QtCore import QTimer
from PyQt4.QtGui import QApplication
app = QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
def tick():
print 'tick'
timer = QTimer()
timer.timeout.connect(tick)
timer.start(1000)
# run event loop so python doesn't exit
app.exec_()