在wxPython中使用wx.CallLater
|
我正在尝试制作一个处理基本时间相关功能的对象。我想要这样,当引用任何属性(例如self.Time)时它们都是最新的。但是,由于某种原因,wx.CallLater(1000,self.Tick)似乎没有更新属性。它只会打印一次self.Time,而不是每秒(就像我想要的那样)。
我将如何获得自己想要的行为?除了wx.CallLater(1000,self.Tick)外,我还应该使用其他东西吗?
片段:
import wx, re, time, win32api, calendar
class TimeDate :
def __init__ (self) :
self.Tick()
def Tick (self) :
self.Year = int(time.strftime(\"%Y\"))
self.Month = int(time.strftime(\"%m\"))
self.Calendar = calendar.month(self.Year, self.Month)
self.Date = time.strftime(\'%A, %B %d, %Y\')
self.Time = time.strftime(\'%I:%M %S %p\')
print self.Time
wx.CallLater(1000, self.Tick)
没有找到相关结果
已邀请:
3 个回复
蓄荣糖些
财沟项胶
-
是一类,应以不同的方式使用。 另一方面,
正是您所需要的。
辽躺
和
都只被叫过一次.....