[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] How is the gr_timer object used?
From: |
Chuck Swiger |
Subject: |
Re: [Discuss-gnuradio] How is the gr_timer object used? |
Date: |
Sun, 08 Jan 2006 08:24:10 -0500 |
At 04:40 PM 1/7/2006 -0500, you wrote:
Subject pretty-much says it all.
In my application, I want to trigger a timer once per second to update a
pair of static text
objects on the display. (With the current sidereal time, for the curious).
Marcus - I stole this from Scandoo and use it all the time:
-----------
class UpdateTimer(wx.Timer):
def __init__(self, target, dur=1000):
wx.Timer.__init__(self)
self.target = target
self.Start(dur)
def Notify(self):
"""Called every timer interval"""
if self.target:
self.target.OnUpdate()
-------------------
# start a timer to check for web commands
self.timer = UpdateTimer(self, 1000) # every 1000 mSec, 1 Sec
-------------------
# timer events - check for web commands
def OnUpdate(self):
cmds = os.listdir("/var/www/cgi-bin/commands/")
<etc>