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