Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Ipywidget selection box not opening

enter image description here

I have a jupyter notebook and I’m running leafmap. I’m trying to add a filepicker that will open up a widget to select a local file. I have the following in a cell:

import ipywidgets as widgets
from ipyfilechooser import FileChooser
import os

padding = "0px 0px 0px 5px"
style = {"description_width": "initial"}

tool_output = widgets.Output(
    layout=widgets.Layout(max_height="150px", max_width="500px", overflow="auto")
)

file_type = widgets.ToggleButtons(
    options=["GeoTIFF", "COG", "STAC", "Microsoft"],
    tooltips=[
        "Open a local GeoTIFF file",
        "Open a remote COG file",
        "Open a remote STAC item",
        "Create COG from Microsoft Planetary Computer",
    ],
)
file_type.style.button_width = "110px"

file_chooser = FileChooser(
    os.getcwd(), sandbox_path=m.sandbox_path, layout=widgets.Layout(width="454px")
)
file_chooser.filter_pattern = ["*.tif", "*.tiff"]
file_chooser.use_dir_icons = True

source_widget = widgets.VBox([file_chooser])

When I run the cell, no selection box opens. What am I doing wrong?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Add display(source_widget) to the end of the cell.

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading