Re: How to run a repeating timer every n minutes?

2009-10-30 Thread Frank Millman
Diez B. Roggisch wrote: mk wrote: I'm newbie at threading, so I'm actually asking: should not method like stop() be surrounded with acquire() and release() of some threading.lock? I mean, is this safe to update running thread's data from the main thread without lock? stop() is part of

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Wesley Brooks
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

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Martin P. Hellwig
VYAS ASHISH M-NTB837 wrote: cut You might want to start a thread with a continues loop that primarily sleeps (time.sleep) but wakes up at regular intervals and executes what needs to be. -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' --

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Frank Millman
Ashish Vyas wrote: Dear All How do I write a code that gets executed 'every x' minutes? [...] Regards, Ashish Vyas Here is one way - import threading class Timer(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.event = threading.Event()

RE: How to run a repeating timer every n minutes?

2009-10-29 Thread VYAS ASHISH M-NTB837
a repeating timer every n minutes? Ashish Vyas wrote: Dear All How do I write a code that gets executed 'every x' minutes? [...] Regards, Ashish Vyas Here is one way - import threading class Timer(threading.Thread): def __init__(self): threading.Thread.__init__(self

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread mk
Frank Millman wrote: class Timer(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.event = threading.Event() def run(self): while not self.event.is_set(): The things I want to do go here.

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Diez B. Roggisch
mk wrote: Frank Millman wrote: class Timer(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.event = threading.Event() def run(self): while not self.event.is_set(): The things I want to do go here.