Skip to main content

TimePickerEntryMode

Interactive input mode of the TimePicker dialog.

In DIAL mode, a clock dial is displayed, and the user taps or drags the time they wish to select. In INPUT mode, TextFields are displayed and the user types in the time they wish to select.

Inherits: enum.Enum

Properties

  • DIAL - User picks time from a clock dial.
  • DIAL_ONLY - User can only pick time from a clock dial.
  • INPUT - User can input the time by typing it into text fields.
  • INPUT_ONLY - User can only input the time by typing it into text fields.

Examples​

Time Picker Entry Mode showcase​

play_arrowTry Online
from datetime import time

import flet as ft


def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER

picker = ft.TimePicker(value=time(hour=19, minute=30))

def open_picker(entry_mode: ft.TimePickerEntryMode):
picker.entry_mode = entry_mode
page.show_dialog(picker)

def showcase_card(entry_mode: ft.TimePickerEntryMode) -> ft.Container:
return ft.Container(
width=320,
padding=12,
border=ft.Border.all(1, ft.Colors.RED),
border_radius=10,
bgcolor=ft.Colors.SURFACE_CONTAINER_LOW,
content=ft.Column(
spacing=8,
controls=[
ft.Text(entry_mode.name, weight=ft.FontWeight.BOLD),
ft.Button(
"Open TimePicker",
icon=ft.Icons.SCHEDULE,
on_click=lambda _, m=entry_mode: open_picker(m),
),
],
),
)

page.appbar = ft.AppBar(title="TimePickerEntryMode Showcase")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Text("Open the picker to compare dial/input entry modes."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[showcase_card(m) for m in ft.TimePickerEntryMode],
),
],
),
)
)


if __name__ == "__main__":
ft.run(main)

Properties​

DIALclass-attributeinstance-attribute​

User picks time from a clock dial.

Can switch to INPUT by activating a mode button in the time picker dialog.

DIAL_ONLYclass-attributeinstance-attribute​

User can only pick time from a clock dial.

There is no user interface to switch to another mode.

INPUTclass-attributeinstance-attribute​

User can input the time by typing it into text fields.

Can switch to DIAL by activating a mode button in the time picker dialog.

INPUT_ONLYclass-attributeinstance-attribute​

User can only input the time by typing it into text fields.

There is no user interface to switch to another mode.