Skip to content
This repository was archived by the owner on Nov 28, 2019. It is now read-only.
This repository was archived by the owner on Nov 28, 2019. It is now read-only.

ListSelector : AttributeError: 'CrossSelect' object has no attribute '_options_dict'  #84

@slamer59

Description

@slamer59

Hello,
I had weird behavior with small list it worked with more than 20 elements I had this problem:

AttributeError                            Traceback (most recent call last)
~/.conda/envs/jupyter/lib/python3.6/site-packages/paramnb/widgets.py in _apply_selection(self, event)
    242         self._lists[selected].options = merged if merged else ['']
    243         self._lists[not selected].options = leftovers if leftovers else ['']
--> 244         self.value = [self._options_dict[o] for o in self._lists[True].options if o != '']
    245         self._apply_filters()
    246 

~/.conda/envs/jupyter/lib/python3.6/site-packages/paramnb/widgets.py in <listcomp>(.0)
    242         self._lists[selected].options = merged if merged else ['']
    243         self._lists[not selected].options = leftovers if leftovers else ['']
--> 244         self.value = [self._options_dict[o] for o in self._lists[True].options if o != '']
    245         self._apply_filters()
    246 

A minimal exemple working:

import paramnb
import param
import numpy as np 
testVar = tuple(np.arange(10))
class SelectionVariables(param.Parameterized):
    int_list                = param.ListSelector(default=testVar, objects=testVar)
    

select = paramnb.Widgets(SelectionVariables)
select

A minimal exemple not working:

import paramnb
import param
import numpy as np 
testVar = tuple(np.arange(21))
class SelectionVariables(param.Parameterized):
    int_list                = param.ListSelector(default=testVar, objects=testVar)
    

select = paramnb.Widgets(SelectionVariables)
select

After digging the documentation the class ListSelectorWidget mention, it switches from a regular SelectMultiple widget to a two-pane CrossSelect widget.

The command below gives me the version of each module:

import ipywidgets
print(ipywidgets.__version__)
print(param.__version__)
print(paramnb.__version__)

7.2.1
1.6.1
2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions