2001-12-07 13:45:16 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import time
|
2001-12-07 13:45:16 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
|
|
|
import wx.gizmos as gizmos
|
2001-12-07 13:45:16 -05:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestPanel(wx.Panel):
|
2001-12-07 13:45:16 -05:00
|
|
|
def __init__(self, parent, log):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
2001-12-07 13:45:16 -05:00
|
|
|
self.log = log
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
led = gizmos.LEDNumberCtrl(self, -1, (25,25), (280, 50))
|
2001-12-10 16:20:48 -05:00
|
|
|
led.SetValue("01234")
|
2001-12-07 13:45:16 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
led = gizmos.LEDNumberCtrl(self, -1, (25,100), (280, 50))
|
2001-12-10 16:20:48 -05:00
|
|
|
led.SetValue("56789")
|
2003-12-08 20:23:28 -05:00
|
|
|
led.SetAlignment(gizmos.LED_ALIGN_RIGHT)
|
2003-03-25 01:35:27 -05:00
|
|
|
led.SetDrawFaded(False)
|
2001-12-07 13:45:16 -05:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
led = gizmos.LEDNumberCtrl(self, -1, (25,175), (280, 50),
|
|
|
|
gizmos.LED_ALIGN_CENTER)# | gizmos.LED_DRAW_FADED)
|
2001-12-07 13:45:16 -05:00
|
|
|
self.clock = led
|
|
|
|
self.OnTimer(None)
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
self.timer = wx.Timer(self)
|
2001-12-07 13:45:16 -05:00
|
|
|
self.timer.Start(1000)
|
2003-12-08 20:23:28 -05:00
|
|
|
self.Bind(wx.EVT_TIMER, self.OnTimer)
|
2001-12-07 13:45:16 -05:00
|
|
|
|
|
|
|
|
|
|
|
def OnTimer(self, evt):
|
|
|
|
t = time.localtime(time.time())
|
|
|
|
st = time.strftime("%I-%M-%S", t)
|
|
|
|
self.clock.SetValue(st)
|
|
|
|
|
|
|
|
|
2004-01-22 18:56:39 -05:00
|
|
|
def ShutdownDemo(self):
|
|
|
|
self.timer.Stop()
|
|
|
|
del self.timer
|
|
|
|
|
2001-12-07 13:45:16 -05:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
|
|
overview = """\
|
2003-12-08 20:23:28 -05:00
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<font size=-1>The following was gleaned as best I could from the wxWindows
|
|
|
|
source, which was a bit reluctant to reveal its secrets. My appologies if
|
|
|
|
I missed anything - jmg</font>
|
|
|
|
<p>
|
2004-01-12 22:17:17 -05:00
|
|
|
<code><b>LEDNumberCtrl</b>( parent, id=-1, pos=wx.DefaultPosition,
|
2003-12-08 20:23:28 -05:00
|
|
|
size=wx.DefaultSize, style=LED_ALIGN_LEFT | LED_DRAW_FADED)</code>
|
|
|
|
|
|
|
|
<p>This is a control that simulates an LED clock display. It only accepts
|
|
|
|
numeric input.
|
|
|
|
|
|
|
|
<p><b>Styles</b>
|
|
|
|
|
|
|
|
<p><dl>
|
|
|
|
<dt><b>LED_ALIGN_LEFT</b>
|
|
|
|
<dd>Align to the left.
|
|
|
|
|
|
|
|
<dt><b>LED_ALIGN_RIGHT</b>
|
|
|
|
<dd>Align to the right.
|
|
|
|
|
|
|
|
<dt><b>LED_ALIGN_CENTER</b>
|
|
|
|
<dd>Center on display.
|
|
|
|
|
|
|
|
<dt><b>LED_DRAW_FADED</b>
|
|
|
|
<dd>Not implemented.
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
<p><b>Methods</b> (and best guesses at what they do)
|
|
|
|
|
|
|
|
<p><dl>
|
|
|
|
<dt><b>GetAlignment()</b>
|
|
|
|
<dd>Returns the alignment attribute for the control.
|
|
|
|
|
|
|
|
<dt><b>GetDrawFaded()</b>
|
|
|
|
<dd>Returns the DrawFaded attribute for the control.
|
|
|
|
|
|
|
|
<dt><b>GetValue()</b>
|
|
|
|
<dd>Returns the current value of the control.
|
|
|
|
|
|
|
|
<dt><b>SetAlignment(alignment)</b>
|
|
|
|
<dd>Set the alignment attribute for the control.
|
|
|
|
|
|
|
|
<dt><b>SetDrawFaded(value)</b>
|
|
|
|
<dd>Set the DrawFaded attribute for the control.
|
|
|
|
|
|
|
|
<dt><b>SetValue(number)</b>
|
|
|
|
<dd>Set the value for the control. Only numeric values are accepted.
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
<p>Additionally, several methods of wx.Window are available as well.
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
2001-12-07 13:45:16 -05:00
|
|
|
"""
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2003-07-02 19:13:10 -04:00
|
|
|
|