'FloatSlider' widget crash when setting up a minimum value
See original GitHub issueDescribe the bug
In magicgui 0.6.0 setting up a min value different from 0. for the FloatSlider causes two bugs in the widget.
- The default value shown is wrong. (100000, for default=1, and min=0.1)
- When moving the slider the widget crash
Traceback (most recent call last):
File ".../python3.10/site-packages/magicgui/backends/_qtpy/widgets.py", line 640, in _on_readout_change
self._qwidget.setValue(self._pre_set_hook(self._readout_widget.value()))
OverflowError: argument 1 overflowed: value must be in the range -2147483648 to 2147483647
[1] 12542 IOT instruction (core dumped) python test.py
Some more details:
- The error does not affect the function call. If I run the widget in the example below, I get the correct value 1.
- if I set
min=0.the widget works normally. - Typing a new value next to the slider causes the same
Tracebackas above.
To Reproduce
from magicgui import magicgui
@magicgui(call_button='Run',
sigma={'label': 'Sigma',
'widget_type': 'FloatSlider',
'max': 5.0,
'min': 0.1})
def widget_test(sigma: float = 1.0) -> None:
print(sigma)
widget_test.show(run=True)
Screenshots

Environment (please complete the following information):
- OS: linux, fedora 35
- backend: Qt: 5.12.9, PyQt5: 5.12.3
- magicgui version 0.6.0
- python: 3.10
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
FloatSlider sometimes approximates the max and does ...
Running the following code I get a widget in the range [0.2, 0.5] instead of [0.2,0.6]: w = widgets.FloatSlider(value = 0.5, min =...
Read more >Source code for pywwt.jupyter
DOMWidget, BaseWWTWidget): """ An AAS WorldWide Telescope Jupyter widget. ... FloatSlider( value=self.foreground_opacity, min=0, max=1, readout=False ) ...
Read more >Cursor of FloatSlide widget doesn't move
First, thankyou for the complete runnable example (with imports!) I think this might be to do with the minimum value or step size...
Read more >Python Jupyter Widgets - YouTube
Widget in Jupyter using ipywidgets. http://nbviewer.jupyter.org/url/ignite.byu.edu/che263/lectureNotes/ widgets.ipynb.
Read more >FloatSlider — Panel v0.14.2
The FloatSlider widget allows selecting selecting a numeric floating-point value within a set bounds using a slider. For more information about listening to ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Fixed in 0.6.1
Just encountered the same (probably) issue, ~but with slightly different error~ [EDIT: looks like it’s exactly the same, my bad 😛]:
The slider works fine, and the printed values are in the correct range. However, the label is the problem:
And if I try to edit it, this error appears: