]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/AnalogClockWindow.py
Reworked how stock objects are initialized. They now have an
[wxWidgets.git] / wxPython / demo / AnalogClockWindow.py
1 # 11/4/03 - grimmtooth@softhome.net (Jeff Grimmett)
2 #
3 # o wx Namespace
4 #
5
6 import wx
7 import wx.lib.analogclock as aclock
8
9 #----------------------------------------------------------------------
10
11 class TestPanel(wx.Panel):
12 def __init__(self, parent, log):
13 self.log = log
14 wx.Panel.__init__(self, parent, -1)
15
16 # A red background with blue hands and white markings
17 c1 = aclock.AnalogClockWindow(self)
18 c1.SetBackgroundColour("RED")
19 c1.SetHandsColour("BLUE")
20 c1.SetTickMarkColours("WHITE")
21
22 # A white background with red hands and blue markings
23 c2 = aclock.AnalogClockWindow(self)
24 c2.SetBackgroundColour("WHITE")
25 c2.SetHandsColour("RED")
26 c2.SetTickMarkColours("BLUE")
27
28 # A blue background with white hands and red markings
29 c3 = aclock.AnalogClockWindow(self)
30 c3.SetBackgroundColour("BLUE")
31 c3.SetHandsColour("WHITE")
32 c3.SetTickMarkColours("RED")
33
34 # Raised border, circular tick marks.
35 c4 = aclock.AnalogClockWindow(self, style=wx.RAISED_BORDER)
36 c4.SetTickMarkStyle(aclock.AnalogClockWindow.TICKS_CIRCLE)
37
38 # No tick marks
39 c5 = aclock.AnalogClockWindow(self)
40 c5.SetTickMarkStyle(aclock.AnalogClockWindow.TICKS_NONE)
41
42 # Sunken into window
43 c6 = aclock.AnalogClockWindow(self, style=wx.SUNKEN_BORDER)
44
45 # layout the clocks in a grid sizer
46 gs = wx.GridSizer(2, 3, 4, 4)
47 gs.Add(c1, 0, wx.EXPAND)
48 gs.Add(c2, 0, wx.EXPAND)
49 gs.Add(c3, 0, wx.EXPAND)
50 gs.Add(c4, 0, wx.EXPAND)
51 gs.Add(c5, 0, wx.EXPAND)
52 gs.Add(c6, 0, wx.EXPAND)
53
54 # put it in another sizer for a border
55 sizer = wx.BoxSizer(wx.VERTICAL)
56 sizer.Add(gs, 1, wx.EXPAND|wx.ALL, 10)
57
58 self.SetSizer(sizer)
59
60
61 #----------------------------------------------------------------------
62
63 def runTest(frame, nb, log):
64 win = TestPanel(nb, log)
65 return win
66
67 #----------------------------------------------------------------------
68
69
70
71 overview = """<html><body>
72 <h2><center>AnalogClockWindow</center></h2>
73
74 This is a nice little clock class that was contributed to by several
75 members of the wxPython-users group.
76
77 </body></html>
78 """
79
80 if __name__ == '__main__':
81 import sys,os
82 import run
83 run.main(['', os.path.basename(sys.argv[0])])
84