Wxpython, using more than 1 timer?
janama
austuff at gmail.com
Sat Jul 22 07:37:39 EDT 2006
Hi all,
Using wx
When adding a second timer as i have the first, the second timer
adding stops the first timer (updating or stops?) . In this example im
updating a uptime and localtime label. It works fine for displaying the
last "self.startTimer2()" called. But prevents the previous
self.startTimer1() from running . Im doing something fundamentally
wrong i guess?
def __init__(self, parent):
self._init_ctrls(parent)
#Start timers
self.startTimer1()
self.startTimer2()
def startTimer1(self):
self.t1 = wx.Timer(self)
self.t1.Start(360) # 360000 ms = 1/10 hour
self.Bind(wx.EVT_TIMER, self.OnUpTime)
def startTimer2(self):
self.t2 = wx.Timer(self)
self.t2.Start(1000) # run every second
self.Bind(wx.EVT_TIMER, self.OnTime)
def OnTime(self,evt):
self.lblTime.SetLabel(str(time.localtime()))
def OnUpTime(self, evt):
self.lblUptime.SetLabel('Running ' + (str(myTimerText[0])) + '
hours') # 1/10 hour count
myTimerText[0] = myTimerText[0] + .1
Any help appreciated, ta
More information about the Python-list
mailing list