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