There is an icon in the program; by clicking on it, a window with information should appear on top of the program. How can this be implemented?
import flet as ft
def main(page: ft.page):
page.title = "Тренировка интуиции"
page.window_width = 400.00
page.window_height = 500.00
page.window_resizable = False
def info(e):
# info text
pass
page.add(ft.Row([ft.IconButton(ft.icons.HELP, on_click=info)], alignment=ft.alignment.center))
ft.app(target=main)
Please tell me, I’ve been studying recently
import flet as ft
def main(page: ft.page):
page.title = "Тренировка интуиции"
page.window_width = 400.00
page.window_height = 500.00
page.window_resizable = False
Build info dialog with using AlertDialog
. Add action
to close your dialog. Content
is the main content in pop-up.
def info(e):
diaolog = ft.AlertDialog(title=ft.Text("Information"),
content=ft.Text("Test Text"),
actions=[ft.TextButton(text="Close", on_click=close_diaolog)],
open=True,
)
page.dialog = diaolog
page.update()
Built close_diaolog
to close dialog after click Close.
def close_diaolog(e):
page.dialog.open = False
page.update()
page.add(ft.Row([ft.IconButton(ft.icons.HELP, on_click=info)], alignment=ft.alignment.center))
ft.app(target=main)