2

I've tried and failed to convert the MultiFileSelector Param to into a widget that can be interacted with. From this tutorial, I have tried the following.

class CustomExample(param.Parameterized):
    f = param.MultiFileSelector()

pn.Param(CustomExample.param, widgets={ 'f': pn.widgets.Multiselect})

But I get the error,

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-bb344c131fb8> in <module>
      5     #select_number = param.Selector(objects=[0, 1, 10, 100])
      6 
----> 7 pn.Param(CustomExample.param, widgets={ 'f': pn.widgets.Multiselect})

AttributeError: module 'panel.widgets' has no attribute 'Multiselect'

Any pointers will be great.

user17161
  • 21
  • 2

1 Answers1

0

Since you are using param, you have to check which parameter comes closest to what you are looking for in this case param.MultiFileSelector:

class CustomExample(param.Parameterized):
    file_selector = param.MultiFileSelector(path='*')

pn.Param(CustomExample.param['file_selector'])

This will show the following multifile selector: standard multifile selector with param pyviz

If you want to change to a different non-default selector, you can do that like this:

class CustomExample(param.Parameterized):
    file_selector = param.MultiFileSelector(path='*')

pn.Param(
    CustomExample.param['file_selector'], 
    widgets={'file_selector': pn.widgets.CrossSelector},
))

Resulting selector: overwrite default multi file selector with the panel crosselector


You already found this documentation:
http://panel.holoviz.org/user_guide/Param.html

But maybe also have a look at these SO-questions:
Get a different (non default) widget when using param in parameterized class (holoviz param panel)

What is the best way to change the widget type in an hvplot/holoviews/panel object?

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
  • Thanks @Sander. I checked the suggested links but could not find a way to double click a folder and choose files within that folder. Sort of like a file browser. – user17161 Jan 21 '20 at 08:29
  • Ah, so you're looking for a selector where you get a file browser AND are able to select multiple files, like this: https://panel.holoviz.org/reference/widgets/FileInput.html#gallery-fileinput but then for multiple files. It's best to put your question here, hope they can help your: https://discourse.holoviz.org/ – Sander van den Oord Jan 21 '20 at 08:47
  • As suggested, I think the best place to post your question would be here: https://discourse.holoviz.org/ – Sander van den Oord Jan 21 '20 at 09:20