1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#!/usr/bin/env python
import wx
import wx.adv
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
self.tpc = wx.adv.TimePickerCtrl(self, size=(120, -1),
style = wx.adv.TP_DEFAULT)
self.Bind(wx.adv.EVT_TIME_CHANGED, self.OnTimeChanged, self.tpc)
sizer.Add(self.tpc, 0, wx.ALL, 50)
def OnTimeChanged(self, evt):
self.log.write("OnTimeChanged: hour: %s min: %s sec: %s\n" % self.tpc.GetTime())
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>wx.TimePickerCtrl</center></h2>
<p>
This control allows the user to enter time.
</p>
<p>
It is similar to DatePickerCtrl but is used for time, and not date, selection.
While GetValue and SetValue still work with values of type DateTime (because
wxWidgets doesn't provide a time-only class), their date part is
ignored by this control.
</p>
<p>
It is only available if USE_TIMEPICKCTRL is set to 1.
</p>
<p>
This control currently doesn't have any specific flags.
</p>
</body></html>
"""
if __name__ == '__main__':
import sys
import os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|