Skip to content

Unable to stack a Plot and an ImageWidget using a VBox #337

@X4ndri

Description

@X4ndri

I'm currently on v0.1.0.a13. I'm trying to stack an ImageWidget and a Plot using a VBox - I am getting the following long traceback:

---------------------------------------------------------------------------
TraitError                                Traceback (most recent call last)
Cell In[16], line 17
      8 traces_gfx[bad_idx].colors = 'magenta'
      9 # def update_movie(ev):
     10 #     ix = ev.pick_info["selected_index"][0]
     11 #     iw_cnmf.sliders["t"].value = ix 
   (...)
     14 # traces_gfx.add_linear_selector(name="x")
     15 # traces_plot["x"].selection.add_event_handler(update_movie)
---> 17 VBox([iwc.show(), traces_plot.show()])

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/ipywidgets/widgets/widget_box.py:64, in Box.__init__(self, children, **kwargs)
     62 def __init__(self, children=(), **kwargs):
     63     kwargs['children'] = children
---> 64     super().__init__(**kwargs)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/ipywidgets/widgets/widget.py:503, in Widget.__init__(self, **kwargs)
    501 """Public constructor"""
    502 self._model_id = kwargs.pop('model_id', None)
--> 503 super().__init__(**kwargs)
    505 Widget._call_widget_constructed(self)
    506 self.open()

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:1347, in HasTraits.__init__(self, *args, **kwargs)
   1345 for key, value in kwargs.items():
   1346     if self.has_trait(key):
-> 1347         setattr(self, key, value)
   1348         changes[key] = Bunch(
   1349             name=key,
   1350             old=None,
   (...)
   1353             type="change",
   1354         )
   1355     else:
   1356         # passthrough args that don't set traits to super

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:732, in TraitType.__set__(self, obj, value)
    730     raise TraitError('The "%s" trait is read-only.' % self.name)
    731 else:
--> 732     self.set(obj, value)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:706, in TraitType.set(self, obj, value)
    705 def set(self, obj, value):
--> 706     new_value = self._validate(obj, value)
    707     try:
    708         old_value = obj._trait_values[self.name]

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:738, in TraitType._validate(self, obj, value)
    736     return value
    737 if hasattr(self, "validate"):
--> 738     value = self.validate(obj, value)
    739 if obj._cross_validation_lock is False:
    740     value = self._cross_validate(obj, value)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:2871, in Container.validate(self, obj, value)
   2868 if value is None:
   2869     return value
-> 2871 value = self.validate_elements(obj, value)
   2873 return value

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:2883, in Container.validate_elements(self, obj, value)
   2881     v = self._trait._validate(obj, v)
   2882 except TraitError as error:
-> 2883     self.error(obj, v, error)
   2884 else:
   2885     validated.append(v)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:823, in TraitType.error(self, obj, value, error, info)
    812         else:
    813             error.args = (
    814                 "The '%s' trait contains %s which "
    815                 "expected %s, not %s."
   (...)
    821                 ),
    822             )
--> 823     raise error
    824 else:
    825     # this trait caused an error
    826     if self.name is None:
    827         # this is not the root trait

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:2881, in Container.validate_elements(self, obj, value)
   2879 for v in value:
   2880     try:
-> 2881         v = self._trait._validate(obj, v)
   2882     except TraitError as error:
   2883         self.error(obj, v, error)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:738, in TraitType._validate(self, obj, value)
    736     return value
    737 if hasattr(self, "validate"):
--> 738     value = self.validate(obj, value)
    739 if obj._cross_validation_lock is False:
    740     value = self._cross_validate(obj, value)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:2151, in Instance.validate(self, obj, value)
   2149     return value
   2150 else:
-> 2151     self.error(obj, value)

File ~/miniconda3/envs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:828, in TraitType.error(self, obj, value, error, info)
    824 else:
    825     # this trait caused an error
    826     if self.name is None:
    827         # this is not the root trait
--> 828         raise TraitError(value, info or self.info(), self)
    829     else:
    830         # this is the root trait
    831         if obj is not None:

TraitError: The 'children' trait of a VBox instance contains an Instance of a TypedTuple which expected a Widget, not the NoneType None.```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions