Skip to content

examples/labeled_sliders.py broken #308

@gselzer

Description

@gselzer

Describe the bug
When running examples//labeled_sliders.py, you get the following printout:

> uv run python .\examples\labeled_sliders.py
qls valueChanged 300
qlds valueChanged 0.5
Traceback (most recent call last):
  File "C:\Users\gjselzer\code\pyapp-kit\superqt\examples\labeled_sliders.py", line 31, in <module>
    qlrs.setRange(0, 10**11)
    ~~~~~~~~~~~~~^^^^^^^^^^^
  File "C:\Users\gjselzer\code\pyapp-kit\superqt\src\superqt\sliders\_labeled.py", line 448, in setRange
    self._on_range_changed(min, max)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\gjselzer\code\pyapp-kit\superqt\src\superqt\sliders\_labeled.py", line 608, in _on_range_changed
    self._slider.setRange(min, max)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\Users\gjselzer\code\pyapp-kit\superqt\src\superqt\sliders\_generic_slider.py", line 171, in setRange
    self.rangeChanged.emit(self._minimum, self._maximum)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: rangeChanged(self, min: int, max: int).emit(): argument 2 has unexpected type 'int'

This comes from trying to emit the QSlider.rangeChanged signal of the backing QSlider. I did spend a while attempting a fix however looking at the code as well as relevant issues/PRs (especially #249 and #283), I have a feeling that I'm falling down a rabbit hole. Thoughts @tlambert03?

To Reproduce
Steps to reproduce the behavior:

  1. Run python examples/labeled_slider.py

Expected behavior
The example to run bug-free

Screenshots
Screenshots and GIFS are much appreciated when reporting visual bugs.

Desktop (please complete the following information):

  • OS with version [e.g macOS 10.15.7] Windows 11
  • Qt Backend [e.g PyQt5, PySide2] PyQt6
  • Python version 3.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions