-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
should be able to fix by using FloatRangeSlider.set_state() to set everything at once instead of one by one.
---------------------------------------------------------------------------
TraitError Traceback (most recent call last)
Cell In [10], line 1
----> 1 cw.image_widget.reset_vmin_vmax()
File ~/repos/fastplotlib/fastplotlib/widgets/image.py:840, in ImageWidget.reset_vmin_vmax(self)
838 for i, ig in enumerate(self.image_graphics):
839 mm = self._get_vmin_vmax_range(ig.data())
--> 840 self.vmin_vmax_sliders[i].min = mm[2]
841 self.vmin_vmax_sliders[i].max = mm[3]
842 self.vmin_vmax_sliders[i].step = mm[1] / 150
File ~/python-venvs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:715, in TraitType.__set__(self, obj, value)
713 raise TraitError('The "%s" trait is read-only.' % self.name)
714 else:
--> 715 self.set(obj, value)
File ~/python-venvs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:689, in TraitType.set(self, obj, value)
688 def set(self, obj, value):
--> 689 new_value = self._validate(obj, value)
690 try:
691 old_value = obj._trait_values[self.name]
File ~/python-venvs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:723, in TraitType._validate(self, obj, value)
721 value = self.validate(obj, value) # type:ignore[attr-defined]
722 if obj._cross_validation_lock is False:
--> 723 value = self._cross_validate(obj, value)
724 return value
File ~/python-venvs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:729, in TraitType._cross_validate(self, obj, value)
727 if self.name in obj._trait_validators:
728 proposal = Bunch({"trait": self, "value": value, "owner": obj})
--> 729 value = obj._trait_validators[self.name](obj, proposal)
730 elif hasattr(obj, "_%s_validate" % self.name):
731 meth_name = "_%s_validate" % self.name
File ~/python-venvs/mescore/lib/python3.10/site-packages/traitlets/traitlets.py:1132, in EventHandler.__call__(self, *args, **kwargs)
1130 """Pass `*args` and `**kwargs` to the handler's function if it exists."""
1131 if hasattr(self, "func"):
-> 1132 return self.func(*args, **kwargs)
1133 else:
1134 return self._init_call(*args, **kwargs)
File ~/python-venvs/mescore/lib/python3.10/site-packages/ipywidgets/widgets/widget_float.py:315, in _BoundedFloatRange._validate_bounds(self, proposal)
313 new = proposal['value']
314 if trait.name == 'min' and new > self.max:
--> 315 raise TraitError('setting min > max')
316 if trait.name == 'max' and new < self.min:
317 raise TraitError('setting max < min')
TraitError: setting min > max
Metadata
Metadata
Assignees
Labels
No labels