How to run a repeating timer every n minutes?

Wesley Brooks wesbrooks at gmail.com
Thu Oct 29 07:22:38 EDT 2009


I use the wx.Timer for this:

import wx

timer = wx.Timer(self, -1)
# update gui every 1/4 second (250ms)
timer.Start(250)
Bind(wx.EVT_TIMER, OnUpdateValues)

In the above I'm running the OnUpdateValues function every 250ms.

Regards,

Wesley Brooks


2009/10/29 VYAS ASHISH M-NTB837 <ashish.vyas at motorola.com>

>
> Dear All
>
> How do I write a code that gets executed 'every x' minutes?
>
>
>
> I know how to do it 'after x' minutes, I do the following:
>
> def doAtTimerFire():
>        """ The things I want to do 'after x' minutes go here. """
>
> And then from main code, I do this:
>
> tmr = threading.Timer(timeInSeconds, doAtTimerFire)
> tmr.start()
>
>
> Sorry about the earlier post with wrong subject line.
> Please help.
>
> Regards,
> Ashish Vyas
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091029/5b6edfb2/attachment-0001.html>


More information about the Python-list mailing list