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

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

Open
slamer59 opened this issue Jun 5, 2018 · 0 comments

Comments

@slamer59
Copy link

slamer59 commented Jun 5, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant