crahan / ipyfilechooser

Python file chooser widget for use in Jupyter/IPython in conjunction with ipywidgets
MIT License
103 stars 19 forks source link

Option to render FileChooser as 'open' when loading #69

Closed simbru closed 2 years ago

simbru commented 2 years ago

Would it be possible to make the step of clicking 'select' to open the FileChooser optional? I feel this might be useful for applications where clicking select to open the widget is somewhat redundant.

crahan commented 2 years ago

Hi @simbru, It's not directly exposed via a parameter, but before you display the widget you can use the _show_dialog() function to open up the dialog:

fdialog = FileChooser(
    os.getcwd(),
    filename='test.txt',
    title='<b>FileChooser example</b>',
    show_hidden=False,
    select_default=True,
    show_only_dirs=False
)

fdialog._show_dialog()
display(fdialog)

Let me know if that helps resolve the issue for you or if you have any additional questions.

simbru commented 2 years ago

Hi @crahan, yes that's great! Exactly what I was looking for :) Thanks a bunch!

crahan commented 2 years ago

Awesome, thanks for confirming!