Time Picker¶
Use a time picker to pick a time using a 12- or 24-hour clock.
Basic¶
Set mode='time'
to show a time picker.
Enable seconds¶
Include seconds in the value
to show a seconds component.
Show hours only¶
Exclude minutes and seconds from the value
to show only the hour component.
Show 24-hour clock¶
Exclude AM
or PM
from the value
to accept input in military time.
Show 24-hour clock, with seconds¶
Include seconds in the value
to show a seconds component.
Show 24-hour clock, with hour only¶
Exclude minutes and seconds from the value
to show only the hour component.
Handle changes immediately¶
Add live
to mode
to handle changes immediately.
time = '3:04PM'
while True:
time = view(
box('Set alarm for:', mode='live time', value=time),
f'Alarm will be set for {time}.',
)
Disable¶
Set disabled=True
to disable.