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