Creating a File Picker

A widget which enables the user to select multiple files from the file system, returning a list.


In [ ]:
import glob

import IPython.display
import ipywidgets

Create a text input widget to capture the filepath.


In [ ]:
path = ipywidgets.Text(
    description='String:',
    value='/tmp')

IPython.display.display(path)

Create a SelectMultiple widget, using the passed in path as a source and globing the results.


In [ ]:
options = glob.glob('{}/*'.format(path.value))

files = ipywidgets.SelectMultiple(
    description='Dataset(s)',
    options=options)

IPython.display.display(files)

Print the selected tuple of values for clarity.


In [ ]:
print files.value