Hi all,
I am making an interface in which a Select()
widget will be used to display a list of files that the user can select from a folder which are then loaded into an interactive data visualisation tool. In the UI, the user can also change the folder or search criteria which then updates the file list.
Now, the problem I anticipate is that when the file list gets refreshed, a new file gets, by default, selected, since, as I understand, the Select()
widget must always have one item selected (it cannot have no items selected). Because the loading of data into the visualisation can be slow and require a lot of overhead, I want to try to avoid loading files that are not needed when the user has not explicitly clicked on the file they want to load.
For now, I have implemented this by having a separate “load” button under the widget instead of linking the callback to the Select()
. But from an UI perspective, it would be nicer if the user did not have to click a separate button after selecting the file they wanted to load.
One way I could see this is using a double click, but I see that this does not seem to be possible (Listbox double-click event · Issue #1248 · jupyter-widgets/ipywidgets · GitHub).
Two other ways I could imagine could be:
- “De-selecting”: I could select “none” when I reload
options
of theSelect()
- Distinguish, somehow, the setting of the value by code vs. setting of the value via user interaction in the callback
Does anyone know if either of these is possible?
Thanks!
Gary