Skip to content

flet reloads when fetching files #1171

@bobwatcherx

Description

@bobwatcherx

ezgif-4-fc572d7f22

i'm using the latest flet. and want to fetch the . but it looks like the app is loading. and when after the file is open. doesn't seem to work for uploading to the myuploads directory

root@minx-Lenovo-V145-14AST:/home/minx# flet --version
0.4.2
code

from flet import *
import shutil
def main(page:Page):

	youlocation_file = Text("")

	# CREATE FUNCTION OPEN FILE
	def dialog_picker(e:FilePickerResultEvent):
		for x in e.files:
			shutil.copy(x.name,f"myUploads/{x.name}")
			# SET LOCATION FOLDER IMAGE
			youlocation_file.value = f"myUploads/{x.name}"
			youlocation_file.update()






	Mypick = FilePicker(on_result=dialog_picker)
	page.overlay.append(Mypick)


	page.add(
		Column([
			ElevatedButton("Insert file",
		on_click=lambda _: Mypick.pick_files()
			),
		youlocation_file

			])

		)

flet.app(target=main)

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