Skip to content

get_directory_path issue #1562

@marksterg

Description

@marksterg

Function get_directory_path closes application's window after on_click event. Specifically after the dialog window closes it freezes the app for about 2-3 seconds and then terminates the application.

Code:

Test example from: #1297

Mainly i found this on my code and i tried to test it for clearness with this simple example and it came out that it does not work on it either, so i post the simple one bellow.

import flet as ft


def main(page: ft.Page):
    page.theme_mode = "light"

    def result(e):
        page.add(ft.Text("result :)"))

    my_dialog = ft.FilePicker(on_result=result)

    page.overlay.append(my_dialog)

    page.add(
        ft.Row(
            [
                ft.ElevatedButton("Pick", icon=ft.icons.UPLOAD_FILE,
                                  on_click=lambda _: my_dialog.pick_files()),
                ft.ElevatedButton("Save", icon=ft.icons.UPLOAD_FILE,
                                  on_click=lambda _: my_dialog.save_file()),
                ft.ElevatedButton("Get Dir", icon=ft.icons.UPLOAD_FILE,
                                  on_click=lambda _: my_dialog.get_directory_path()),
            ]
        )
    )


ft.app(target=main)

Results:

  • In the above example will print the text message from the result function, but after it will close the app.

Additional information:

  • pick_files and save_file works fine.

Flet version:

Name: flet
Version: 0.8.0

Operating system:

  • Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions