I'm trying to make a digital clock. One of the problems with it is that the display will "flicker". In other words the wx.StaticText widget (self.ST in this case), will go blank for very short periods. I believe the cause may find it's root in how self.ST updates (ie, SetLabel()). Is there a way to provide smoother transitions, in an effort to stop the flickering?
This is the function where self.ST is updated:
def tick (self):
''' Continually updates the time. '''
TimeStr = '%I:%M %S %p'
DateStr = '%A, %B %d, %Y'
Time = time.strftime(TimeStr)
Date = time.strftime(DateStr)
self.TimeDate = Time + '\t\t' + Date
self.ST.SetLabel(Time)
wx.CallLater(1000, self.tick)
One way to fix the flickering is to enable double buffering in the top container for your widget. Normally this is done by calling self.SetDoubleBuffered(True) within the initialiser, for example within Panel container for your StaticText class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With