TimeInput¶
A widget to select a clock time.
Usage¶
import toga
current_time = toga.TimeInput()
Notes¶
This widget supports hours, minutes and seconds. Microseconds will always be returned as zero.
On Android, seconds will also be returned as zero.
Properties that return
datetime.timeobjects can also accept:datetime.datetime: The time portion will be extracted.str: Will be parsed as an ISO8601 format time string (e.g., “06:12”).
Reference¶
- class toga.TimeInput(id=None, style=None, value=None, min=None, max=None, on_change=None)¶
Bases:
WidgetCreate a new TimeInput widget.
- Parameters:
id – The ID for the widget.
style – A style object. If no style is provided, a default style will be applied to the widget.
value (datetime.time | None) – The initial time to display. If not specified, the current time will be used.
min (datetime.time | None) – The earliest time (inclusive) that can be selected.
max (datetime.time | None) – The latest time (inclusive) that can be selected.
on_change (callable | None) – A handler that will be invoked when the value changes.
- property max: time¶
The maximum allowable time (inclusive). A value of
Nonewill be converted into 23:59:59.When setting this property, the current
valueandminwill be clipped against the new maximum value.
- property min: time¶
The minimum allowable time (inclusive). A value of
Nonewill be converted into 00:00:00.When setting this property, the current
valueandmaxwill be clipped against the new minimum value.
- property on_change: callable¶
The handler to invoke when the time value changes.

