TimeInput¶
Usage¶
import toga
current_time = toga.TimeInput()
Notes¶
- This widget supports hours, minutes and seconds. Microseconds will always be returned as zero.
- On Android and iOS, seconds will also be returned as zero, and any second component of a minimum or maximum value will be ignored.
- Properties that return [
datetime.time][] objects 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¶
Bases: Widget
Source code in core/src/toga/widgets/timeinput.py
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
max
property
writable
¶
min
property
writable
¶
on_change
property
writable
¶
The handler to invoke when the time value changes.
value
property
writable
¶
The currently selected time. A value of None will be converted into the
current time.
If this property is set to a value outside of the min/max range, it will be clipped.
__init__(id=None, style=None, value=None, min=None, max=None, on_change=None, **kwargs)
¶
Create a new TimeInput widget.
:param id: The ID for the widget. :param style: A style object. If no style is provided, a default style will be applied to the widget. :param value: The initial time to display. If not specified, the current time will be used. :param min: The earliest time (inclusive) that can be selected. :param max: The latest time (inclusive) that can be selected. :param on_change: A handler that will be invoked when the value changes. :param kwargs: Initial style properties.
Source code in core/src/toga/widgets/timeinput.py
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 | |
Bases: Protocol
Source code in core/src/toga/widgets/timeinput.py
12 13 14 15 16 17 18 | |
__call__(widget, **kwargs)
¶
A handler to invoke when the time input is changed.
:param widget: The TimeInput that was changed. :param kwargs: Ensures compatibility with arguments added in future versions.
Source code in core/src/toga/widgets/timeinput.py
13 14 15 16 17 18 | |