Start New Discussion within our Software Development Community

The wxPython GUI tool makes it very simple to create nice looking analog clock. The analog clock component was put into simple dialog frame and can be moved about the screen.

# create nice Analog Clock using wxPython
# tested with Python24 and wxPython26  by  HAB

import wx
from wx.lib.analogclock import *

class MyFrame(wx.Dialog):
    """use simple dialog box as frame"""
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, -4, title, size=(300,320))
        self.SetBackgroundColour("blue")

        clock = AnalogClockWindow(self)
        clock.SetBackgroundColour("yellow")
        
        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(clock, 1, wx.EXPAND|wx.ALIGN_CENTER|wx.ALL|wx.SHAPED, 10)

        self.SetAutoLayout(True)
        self.SetSizer(box)
        self.Layout()
        
        self.ShowModal()
        self.Destroy()


app = wx.PySimpleApp()
frame = MyFrame(None, -1, "wx Analog Clock")
# show the frame
frame.Show(True)
# start the event loop
app.MainLoop()
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.