[PyQt] timers from mainwindow

Doug Bell dougb at bellz.org
Tue Sep 14 19:01:57 BST 2010


Sebastian Elsner wrote:
> I would like to start a QTimer from a mainwindow's menu, creating a
> new instance of a custom class. See the example below. All works
> except the timer's callback is never called. Asking if the timer is
> active returns True. I ran out of ideas. Maybe I misunderstand how
> timers work?! Any help appreciated.
> 
> 	def doit(self):
> 		Timers()

You're not keeping a reference to your Timers instance.  It's getting
garbage collected before the timer fires.

Doug


More information about the PyQt mailing list