]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/AnalogClockWindow.py
5 from wx
.lib
import analogclock
as ac
8 #----------------------------------------------------------------------
10 class TestPanel(wx
.Panel
):
11 def __init__(self
, parent
, log
):
13 wx
.Panel
.__init
__(self
, parent
, -1)
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)
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
))
35 # A clock with rotated decimal numbers, shown at all twelve
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
)
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)
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)
60 c6
= ac
.AnalogClockWindow(self
, style
=wx
.SUNKEN_BORDER
)
61 c6
.SetTickSizes(h
=5, m
=2)
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
)
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)
80 #----------------------------------------------------------------------
82 def runTest(frame
, nb
, log
):
83 win
= TestPanel(nb
, log
)
86 #----------------------------------------------------------------------
90 overview
= """<html><body>
91 <h2><center>AnalogClockWindow</center></h2>
93 This is a nice little clock class that was contributed to by several
94 members of the wxPython-users group.
96 Check the options available by right-clicking the clock.
102 if __name__
== '__main__':
105 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])