]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/AnalogClockWindow.py
updates
[wxWidgets.git] / wxPython / demo / AnalogClockWindow.py
CommitLineData
1fded56b 1
f04ad14a
RD
2
3
4import wx
5from wx.lib import analogclock as ac
6
1fded56b
RD
7
8#----------------------------------------------------------------------
9
8fa876ca 10class TestPanel(wx.Panel):
1fded56b
RD
11 def __init__(self, parent, log):
12 self.log = log
8fa876ca 13 wx.Panel.__init__(self, parent, -1)
1fded56b 14
f04ad14a
RD
15 # A mostly default clock
16 c1 = ac.AnalogClockWindow(self)
1fded56b 17 c1.SetBackgroundColour("RED")
f04ad14a
RD
18 c1.SetHandColours("BLUE")
19 c1.SetTickColours("WHITE")
20 c1.SetTickSizes(h=5, m=2)
21
22
23 # A clock with roman numerals, shown only at the quarter
24 # marks, and a separatly coloured watch face.
25 c2 = ac.AnalogClockWindow(self)
1fded56b 26 c2.SetBackgroundColour("WHITE")
f04ad14a
RD
27 c2.SetHandColours("RED")
28 c2.SetTickColours("BLUE")
29 c2.SetTickStyles(ac.TICKS_ROMAN)
30 c2.SetClockStyle(ac.SHOW_QUARTERS_TICKS | ac.SHOW_SHADOWS)
31 c2.SetWatchPenBrush(p=wx.Pen((238, 238, 227), 1, wx.SOLID),
32 b=wx.Brush("CADET BLUE", wx.SOLID))
33 c2.SetTickSizes(h=12)
34
35 # A clock with rotated decimal numbers, shown at all twelve
36 # hour marks
37 c3 = ac.AnalogClockWindow(self)
1fded56b 38 c3.SetBackgroundColour("BLUE")
f04ad14a
RD
39 c3.SetHandColours("WHITE")
40 c3.SetTickColours("RED")
41 c3.SetTickStyles(h=ac.TICKS_DECIMAL)
42 c3.SetClockStyle(ac.SHOW_HOURS_TICKS | ac.ROTATE_TICKS)
43 c3.SetTickSizes(h=14)
1fded56b 44
f04ad14a
RD
45 # a plain clock, with square hour and round minute marks, no
46 # shadow raised border
47 c4 = ac.AnalogClockWindow(self, style=wx.RAISED_BORDER)
48 c4.SetTickStyles(h=ac.TICKS_SQUARE, m=ac.TICKS_CIRCLE)
49 c4.SetClockStyle(ac.SHOW_HOURS_TICKS | ac.SHOW_MINUTES_TICKS)
50 c4.SetTickSizes(h=5, m=2)
1fded56b 51
1fded56b 52
f04ad14a
RD
53 # no minute tick marks
54 c5 = ac.AnalogClockWindow(self)
55 c5.SetTickStyles(h=ac.TICKS_CIRCLE)
56 c5.SetClockStyle(ac.SHOW_HOURS_TICKS | ac.SHOW_SHADOWS | ac.ROTATE_TICKS)
57 c5.SetTickSizes(h=5, m=2)
1fded56b 58
f04ad14a
RD
59 # sunken border
60 c6 = ac.AnalogClockWindow(self, style=wx.SUNKEN_BORDER)
61 c6.SetTickSizes(h=5, m=2)
62
63
64 # layout the clocks in a grid
8fa876ca
RD
65 gs = wx.GridSizer(2, 3, 4, 4)
66 gs.Add(c1, 0, wx.EXPAND)
67 gs.Add(c2, 0, wx.EXPAND)
68 gs.Add(c3, 0, wx.EXPAND)
69 gs.Add(c4, 0, wx.EXPAND)
70 gs.Add(c5, 0, wx.EXPAND)
71 gs.Add(c6, 0, wx.EXPAND)
1fded56b
RD
72
73 # put it in another sizer for a border
8fa876ca 74 sizer = wx.BoxSizer(wx.VERTICAL)
f04ad14a 75 sizer.Add(gs, 1, wx.EXPAND | wx.ALL, 10)
1fded56b
RD
76
77 self.SetSizer(sizer)
78
79
80#----------------------------------------------------------------------
81
82def runTest(frame, nb, log):
83 win = TestPanel(nb, log)
84 return win
85
86#----------------------------------------------------------------------
87
88
89
90overview = """<html><body>
91<h2><center>AnalogClockWindow</center></h2>
92
93This is a nice little clock class that was contributed to by several
94members of the wxPython-users group.
f04ad14a
RD
95<p>
96Check the options available by right-clicking the clock.
1fded56b
RD
97</body></html>
98"""
99
f04ad14a
RD
100
101
1fded56b
RD
102if __name__ == '__main__':
103 import sys,os
104 import run
8eca4fef 105 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
1fded56b 106