folder picker besides file picker #3793
-
QuestionI've been looking for a solution to select a folder in native mode. But so far I've not been successful. There was a good discussion on file&folder pickers, but that only resulted in a file picker: I've tried below, and you can drag in a folder into the ui.upload d&d box. But it trows an error when uploaded. async def choose_file():
files = await app.native.main_window.create_file_dialog(allow_multiple=True)
for file in files:
ui.notify(file)
class AppUI:
def __init__(self):
app.native.settings['ALLOW_DOWNLOADS'] = True
self.left_drawer = self.fill_left_drawer()
self.right_drawer = self.fill_right_drawer()
self.header = self.fill_header()
self.footer = self.fill_footer()
ui.label('CONTENT')
ui.button('choose file', on_click=choose_file)
x = ui.upload(on_upload=lambda e: ui.notify(f'Uploaded {e.name}'), auto_upload=True).classes('max-w-full') TL;DR: Would it not be nice to be able to select a folder for native apps? this might be useful for outputs, or for example to process all images in a given folder |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @da-i, You can do that by passing a folders = await app.native.main_window.create_file_dialog(allow_multiple=True, dialog_type=webview.FOLDER_DIALOG) |
Beta Was this translation helpful? Give feedback.
Hi @da-i,
You can do that by passing a
dialog_type
tocreate_file_dialog
: