-
Notifications
You must be signed in to change notification settings - Fork 594
Open
Labels
bugSomething isn't workingSomething isn't workingdocsRelated to the documentationRelated to the documentation
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
Hi,
Trying file picker example from the doc I'm having below error.
AttributeError: 'Page' object has no attribute 'services'. Did you mean: '_services'?
changing page.services.append(file_picker := ft.FilePicker()) to page._services.append(file_picker := ft.FilePicker()) fix it as indicated in the AttributetError
Is it the doc which is not Updated or a bug ?
Code sample
Code
import flet as ft
def main(page: ft.Page):
page.services.append(file_picker := ft.FilePicker())
async def handle_pick_files(e: ft.Event[ft.Button]):
files = await file_picker.pick_files(allow_multiple=True)
selected_files.value = (
", ".join(map(lambda f: f.name, files)) if files else "Cancelled!"
)
async def handle_save_file(e: ft.Event[ft.Button]):
save_file_path.value = await file_picker.save_file()
async def handle_get_directory_path(e: ft.Event[ft.Button]):
directory_path.value = await file_picker.get_directory_path()
page.add(
ft.Row(
controls=[
ft.Button(
content="Pick files",
icon=ft.Icons.UPLOAD_FILE,
on_click=handle_pick_files,
),
selected_files := ft.Text(),
]
),
ft.Row(
controls=[
ft.Button(
content="Save file",
icon=ft.Icons.SAVE,
on_click=handle_save_file,
disabled=page.web, # disable this button in web mode
),
save_file_path := ft.Text(),
]
),
ft.Row(
controls=[
ft.Button(
content="Open directory",
icon=ft.Icons.FOLDER_OPEN,
on_click=handle_get_directory_path,
disabled=page.web, # disable this button in web mode
),
directory_path := ft.Text(),
]
),
)
ft.run(main)To reproduce
Run the sample code on Flet Version: 0.70.0.dev6491 or higher
Expected behavior
No response
Screenshots / Videos
Captures
[Upload media here]
Operating System
Windows
Operating system details
Win 11
Flet version
Version: 0.70.0.dev6491
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocsRelated to the documentationRelated to the documentation