]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/LEDNumberCtrl.py
1 # 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
9 import wx
.gizmos
as gizmos
11 #----------------------------------------------------------------------
13 class TestPanel(wx
.Panel
):
14 def __init__(self
, parent
, log
):
15 wx
.Panel
.__init
__(self
, parent
, -1)
18 led
= gizmos
.LEDNumberCtrl(self
, -1, (25,25), (280, 50))
21 led
= gizmos
.LEDNumberCtrl(self
, -1, (25,100), (280, 50))
23 led
.SetAlignment(gizmos
.LED_ALIGN_RIGHT
)
24 led
.SetDrawFaded(False)
26 led
= gizmos
.LEDNumberCtrl(self
, -1, (25,175), (280, 50),
27 gizmos
.LED_ALIGN_CENTER
)# | gizmos.LED_DRAW_FADED)
31 self
.timer
= wx
.Timer(self
)
32 self
.timer
.Start(1000)
33 self
.Bind(wx
.EVT_TIMER
, self
.OnTimer
)
36 def OnTimer(self
, evt
):
37 t
= time
.localtime(time
.time())
38 st
= time
.strftime("%I-%M-%S", t
)
39 self
.clock
.SetValue(st
)
43 #----------------------------------------------------------------------
45 def runTest(frame
, nb
, log
):
46 win
= TestPanel(nb
, log
)
49 #----------------------------------------------------------------------
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>
58 <code><b>wxLEDNumberCtrl</b>( parent, id=-1, pos=wx.DefaultPosition,
59 size=wx.DefaultSize, style=LED_ALIGN_LEFT | LED_DRAW_FADED)</code>
61 <p>This is a control that simulates an LED clock display. It only accepts
67 <dt><b>LED_ALIGN_LEFT</b>
68 <dd>Align to the left.
70 <dt><b>LED_ALIGN_RIGHT</b>
71 <dd>Align to the right.
73 <dt><b>LED_ALIGN_CENTER</b>
74 <dd>Center on display.
76 <dt><b>LED_DRAW_FADED</b>
81 <p><b>Methods</b> (and best guesses at what they do)
84 <dt><b>GetAlignment()</b>
85 <dd>Returns the alignment attribute for the control.
87 <dt><b>GetDrawFaded()</b>
88 <dd>Returns the DrawFaded attribute for the control.
91 <dd>Returns the current value of the control.
93 <dt><b>SetAlignment(alignment)</b>
94 <dd>Set the alignment attribute for the control.
96 <dt><b>SetDrawFaded(value)</b>
97 <dd>Set the DrawFaded attribute for the control.
99 <dt><b>SetValue(number)</b>
100 <dd>Set the value for the control. Only numeric values are accepted.
104 <p>Additionally, several methods of wx.Window are available as well.
112 if __name__
== '__main__':
115 run
.main(['', os
.path
.basename(sys
.argv
[0])])