]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/AnalogClockWindow.py
Call event.Skip in OnSize
[wxWidgets.git] / wxPython / demo / AnalogClockWindow.py
1
2
3
4 import wx
5 from wx.lib import analogclock as ac
6
7
8 #----------------------------------------------------------------------
9
10 class TestPanel(wx.Panel):
11 def __init__(self, parent, log):
12 self.log = log
13 wx.Panel.__init__(self, parent, -1)
14
15 # A mostly default clock
16 c1 = ac.AnalogClockWindow(self)
17 c1.SetBackgroundColour("RED")
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)
26 c2.SetBackgroundColour("WHITE")
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)
38 c3.SetBackgroundColour("BLUE")
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)
44
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)
51
52
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)
58
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
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)
72
73 # put it in another sizer for a border
74 sizer = wx.BoxSizer(wx.VERTICAL)
75 sizer.Add(gs, 1, wx.EXPAND | wx.ALL, 10)
76
77 self.SetSizer(sizer)
78
79
80 #----------------------------------------------------------------------
81
82 def runTest(frame, nb, log):
83 win = TestPanel(nb, log)
84 return win
85
86 #----------------------------------------------------------------------
87
88
89
90 overview = """<html><body>
91 <h2><center>AnalogClockWindow</center></h2>
92
93 This is a nice little clock class that was contributed to by several
94 members of the wxPython-users group.
95 <p>
96 Check the options available by right-clicking the clock.
97 </body></html>
98 """
99
100
101
102 if __name__ == '__main__':
103 import sys,os
104 import run
105 run.main(['', os.path.basename(sys.argv[0])])
106