]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | import time | |
3 | ||
4 | import wx | |
5 | import wx.gizmos as gizmos | |
6 | ||
7 | #---------------------------------------------------------------------- | |
8 | ||
9 | class TestPanel(wx.Panel): | |
10 | def __init__(self, parent, log): | |
11 | wx.Panel.__init__(self, parent, -1) | |
12 | self.log = log | |
13 | ||
14 | led = gizmos.LEDNumberCtrl(self, -1, (25,25), (280, 50)) | |
15 | led.SetValue("01234") | |
16 | ||
17 | led = gizmos.LEDNumberCtrl(self, -1, (25,100), (280, 50)) | |
18 | led.SetValue("56789") | |
19 | led.SetAlignment(gizmos.LED_ALIGN_RIGHT) | |
20 | led.SetDrawFaded(False) | |
21 | ||
22 | led = gizmos.LEDNumberCtrl(self, -1, (25,175), (280, 50), | |
23 | gizmos.LED_ALIGN_CENTER)# | gizmos.LED_DRAW_FADED) | |
24 | self.clock = led | |
25 | self.OnTimer(None) | |
26 | ||
27 | self.timer = wx.Timer(self) | |
28 | self.timer.Start(1000) | |
29 | self.Bind(wx.EVT_TIMER, self.OnTimer) | |
30 | ||
31 | ||
32 | def OnTimer(self, evt): | |
33 | t = time.localtime(time.time()) | |
34 | st = time.strftime("%I-%M-%S", t) | |
35 | self.clock.SetValue(st) | |
36 | ||
37 | ||
38 | ||
39 | #---------------------------------------------------------------------- | |
40 | ||
41 | def runTest(frame, nb, log): | |
42 | win = TestPanel(nb, log) | |
43 | return win | |
44 | ||
45 | #---------------------------------------------------------------------- | |
46 | ||
47 | overview = """\ | |
48 | <html> | |
49 | <body> | |
50 | <font size=-1>The following was gleaned as best I could from the wxWindows | |
51 | source, which was a bit reluctant to reveal its secrets. My appologies if | |
52 | I missed anything - jmg</font> | |
53 | <p> | |
54 | <code><b>LEDNumberCtrl</b>( parent, id=-1, pos=wx.DefaultPosition, | |
55 | size=wx.DefaultSize, style=LED_ALIGN_LEFT | LED_DRAW_FADED)</code> | |
56 | ||
57 | <p>This is a control that simulates an LED clock display. It only accepts | |
58 | numeric input. | |
59 | ||
60 | <p><b>Styles</b> | |
61 | ||
62 | <p><dl> | |
63 | <dt><b>LED_ALIGN_LEFT</b> | |
64 | <dd>Align to the left. | |
65 | ||
66 | <dt><b>LED_ALIGN_RIGHT</b> | |
67 | <dd>Align to the right. | |
68 | ||
69 | <dt><b>LED_ALIGN_CENTER</b> | |
70 | <dd>Center on display. | |
71 | ||
72 | <dt><b>LED_DRAW_FADED</b> | |
73 | <dd>Not implemented. | |
74 | ||
75 | </dl> | |
76 | ||
77 | <p><b>Methods</b> (and best guesses at what they do) | |
78 | ||
79 | <p><dl> | |
80 | <dt><b>GetAlignment()</b> | |
81 | <dd>Returns the alignment attribute for the control. | |
82 | ||
83 | <dt><b>GetDrawFaded()</b> | |
84 | <dd>Returns the DrawFaded attribute for the control. | |
85 | ||
86 | <dt><b>GetValue()</b> | |
87 | <dd>Returns the current value of the control. | |
88 | ||
89 | <dt><b>SetAlignment(alignment)</b> | |
90 | <dd>Set the alignment attribute for the control. | |
91 | ||
92 | <dt><b>SetDrawFaded(value)</b> | |
93 | <dd>Set the DrawFaded attribute for the control. | |
94 | ||
95 | <dt><b>SetValue(number)</b> | |
96 | <dd>Set the value for the control. Only numeric values are accepted. | |
97 | ||
98 | </dl> | |
99 | ||
100 | <p>Additionally, several methods of wx.Window are available as well. | |
101 | ||
102 | </body> | |
103 | </html> | |
104 | """ | |
105 | ||
106 | ||
107 | ||
108 | if __name__ == '__main__': | |
109 | import sys,os | |
110 | import run | |
111 | run.main(['', os.path.basename(sys.argv[0])]) | |
112 |