This control allows the user to enter time.
It is similar to wx.adv.DatePickerCtrl but is used for time, and not date, selection. While GetValue
and SetValue
still work with values of type wx.DateTime (because wxWidgets doesn’t provide a time-only class), their date part is ignored by this control.
It is only available if USE_TIMEPICKCTRL
is set to 1.
This control currently doesn’t have any specific flags.
Handlers bound for the following event types will receive a wx.adv.DateEvent parameter.
New in version 2.9.3.
See also
__init__ |
Default constructor. |
Create |
Create the control window. |
GetTime |
Returns the currently entered time as hours, minutes and seconds. |
GetValue |
Returns the currently entered time. |
SetTime |
Changes the current time of the control. |
SetValue |
Changes the current value of the control. |
wx.adv.
TimePickerCtrl
(Control)¶Possible constructors:
TimePickerCtrl()
TimePickerCtrl(parent, id=ID_ANY, dt=DefaultDateTime,
pos=DefaultPosition, size=DefaultSize, style=TP_DEFAULT,
validator=DefaultValidator, name="timectrl")
This control allows the user to enter time.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
__init__ (self, parent, id=ID_ANY, dt=DefaultDateTime, pos=DefaultPosition, size=DefaultSize, style=TP_DEFAULT, validator=DefaultValidator, name=”timectrl”)
Initializes the object and calls Create
with all the parameters.
Parameters: |
|
---|
Create
(self, parent, id=ID_ANY, dt=DefaultDateTime, pos=DefaultPosition, size=DefaultSize, style=DP_DEFAULT|DP_SHOWCENTURY, validator=DefaultValidator, name="timectrl")¶Create the control window.
This method should only be used for objects created using default constructor.
Parameters: |
|
---|---|
Return type: | bool |
Returns: |
|
GetTime
(self)¶Returns the currently entered time as hours, minutes and seconds.
All the arguments must be not None
, False
is returned otherwise and none of them is modified.
Return type: | tuple |
---|---|
Returns: | ( hour, min, sec ) |
New in version 2.9.4.
See also
GetValue
(self)¶Returns the currently entered time.
The date part of the returned wx.DateTime object is always set to today and should be ignored, only the time part is relevant.
Return type: | DateTime |
---|
SetTime
(self, hour, min, sec)¶Changes the current time of the control.
Calling this method does not result in a time change event.
Parameters: |
|
---|---|
Return type: | bool |
Returns: |
|
New in version 2.9.4.
See also
SetValue
(self, dt)¶Changes the current value of the control.
The date part of dt is ignored, only the time part is displayed in the control. The dt object must however be valid.
In particular notice that it is a bad idea to use default wx.DateTime constructor from hour, minute and second values as it uses the today date for the date part which means that some times can be invalid if today happens to be the day of DST
change. For example, when switching to summer time the time 2:00 typically doesn’t exist as the clocks jump directly to 3:00. To avoid this problem, use a fixed date on which DST
is known not to change (e.g. Jan 1, 2012) for the date part of the argument or use SetTime
.
Calling this method does not result in a time change event.
Parameters: | dt (wx.DateTime) – |
---|