Custom Controls → AnalogClock

Overview = """\
Just demo digital clock!
reference wxPython document for more detail.
"""
   
   
import wx
import wx.lib.analogclock as analogclock
class Frame(wx.Frame):

def __init__(
  self, parent=None, id=wx.ID_ANY, title='AnalogClock', 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)
  
  clock = analogclock.AnalogClock(panel, style=wx.RAISED_BORDER,
           hoursStyle=analogclock.TICKS_BINARY,
           minutesStyle=analogclock.TICKS_CIRCLE,
           clockStyle=analogclock.SHOW_HOURS_TICKS|
             analogclock.SHOW_MINUTES_TICKS|
             analogclock.SHOW_HOURS_HAND|
             analogclock.SHOW_MINUTES_HAND|
             analogclock.SHOW_SECONDS_HAND)
  # Set hour-tick's size           
  clock.SetTickSize(12, target=analogclock.HOUR)
  
  # Fill the hand with colour
  colour = wx.Colour(0, 255, 255)
  clock.SetHandFillColour(colour)
  # Set the colour of hand's border
  colour = wx.Colour(179, 0, 89)
  clock.SetHandBorderColour(colour)
  
  # Fill the tick with colour
  colour = wx.Colour(255, 0, 0)
  clock.SetTickFillColour(colour)
  # Set the colour of tick's border
  colour = wx.Colour(0, 255, 0)
  clock.SetTickBorderColour(colour)
  
  # Set the colour of face's border
  colour = wx.Colour(0, 0, 255)
  clock.SetFaceBorderColour(colour)
  
  # Set the colour of the background
  colour = wx.Colour(128, 64, 0)
  clock.SetBackgroundColour(colour)
  
  
  
  sizer = wx.BoxSizer()
  sizer.Add(clock, 1, wx.EXPAND)
  panel.SetSizer(sizer)
  
  
  
def TestFrame():
app = wx.PySimpleApp()
frame = Frame(size=(640, 480))
frame.Centre()
frame.Show()
app.MainLoop()


if __name__ == '__main__':
TestFrame()