]>
Commit | Line | Data |
---|---|---|
1fded56b | 1 | |
8fa876ca RD |
2 | import wx |
3 | import wx.lib.analogclock as aclock | |
1fded56b RD |
4 | |
5 | #---------------------------------------------------------------------- | |
6 | ||
8fa876ca | 7 | class TestPanel(wx.Panel): |
1fded56b RD |
8 | def __init__(self, parent, log): |
9 | self.log = log | |
8fa876ca | 10 | wx.Panel.__init__(self, parent, -1) |
1fded56b | 11 | |
8fa876ca RD |
12 | # A red background with blue hands and white markings |
13 | c1 = aclock.AnalogClockWindow(self) | |
1fded56b RD |
14 | c1.SetBackgroundColour("RED") |
15 | c1.SetHandsColour("BLUE") | |
16 | c1.SetTickMarkColours("WHITE") | |
17 | ||
8fa876ca RD |
18 | # A white background with red hands and blue markings |
19 | c2 = aclock.AnalogClockWindow(self) | |
1fded56b RD |
20 | c2.SetBackgroundColour("WHITE") |
21 | c2.SetHandsColour("RED") | |
22 | c2.SetTickMarkColours("BLUE") | |
23 | ||
8fa876ca RD |
24 | # A blue background with white hands and red markings |
25 | c3 = aclock.AnalogClockWindow(self) | |
1fded56b RD |
26 | c3.SetBackgroundColour("BLUE") |
27 | c3.SetHandsColour("WHITE") | |
28 | c3.SetTickMarkColours("RED") | |
29 | ||
8fa876ca RD |
30 | # Raised border, circular tick marks. |
31 | c4 = aclock.AnalogClockWindow(self, style=wx.RAISED_BORDER) | |
32 | c4.SetTickMarkStyle(aclock.AnalogClockWindow.TICKS_CIRCLE) | |
1fded56b | 33 | |
8fa876ca RD |
34 | # No tick marks |
35 | c5 = aclock.AnalogClockWindow(self) | |
36 | c5.SetTickMarkStyle(aclock.AnalogClockWindow.TICKS_NONE) | |
1fded56b | 37 | |
8fa876ca RD |
38 | # Sunken into window |
39 | c6 = aclock.AnalogClockWindow(self, style=wx.SUNKEN_BORDER) | |
1fded56b | 40 | |
8fa876ca RD |
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) | |
1fded56b RD |
49 | |
50 | # put it in another sizer for a border | |
8fa876ca RD |
51 | sizer = wx.BoxSizer(wx.VERTICAL) |
52 | sizer.Add(gs, 1, wx.EXPAND|wx.ALL, 10) | |
1fded56b RD |
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 | ||
1fded56b RD |
76 | if __name__ == '__main__': |
77 | import sys,os | |
78 | import run | |
79 | run.main(['', os.path.basename(sys.argv[0])]) | |
80 |