Custom Controls → LEDNumberCtrl

overview = """\

This is a control that simulates an LED clock display. It only accepts
numeric input.

"""
     
import wx
import wx.gizmos
import time
  
  
class Frame(wx.Frame):

def __init__(
  self, parent=None, id=wx.ID_ANY, title='wx.lib.LEDNumberCtrl', pos=wx.DefaultPosition,
  size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
  ):
  
  wx.Frame.__init__(self, parent, id, title, pos, size, style)
  self.SetIcon(wx.Icon('wxWidgets.ico', wx.BITMAP_TYPE_ICO))
  
  panel = wx.Panel(self, wx.ID_ANY)
  ledNumberCtrl = wx.gizmos.LEDNumberCtrl(panel, wx.ID_ANY, (25, 25), (280, 50), wx.gizmos.LED_ALIGN_CENTER)
  self.digitalClock = ledNumberCtrl
  
  self.timer = wx.Timer(self)
  self.timer.Start(1000)
  self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
  
  
def OnTimer(self, event):
  currentTime = time.localtime(time.time())
  strTime = time.strftime("%I-%M-%S", currentTime)
  self.digitalClock.SetValue(strTime)
  
  
  
def TestFrame():
app = wx.PySimpleApp()
frame = Frame(size=(340, 200))
frame.Centre()
frame.Show()
app.MainLoop()


if __name__ == '__main__':
TestFrame()