pyqt5 sliders

PyQt5 comes with sliders out of the box.

Sliders can be either vertical or horizontal. We can connect them with a method the same way as we do with buttons.

A slider is often used in conjunction with a spinbox, QSpinBox. In this example we won’t use a spinbox, as that’s optional. You can connect a slider to any widget or functionality you want.

Related course:

Slider example
We create a groupbox which contains 4 sliders. A slider is created with the class QSlider, which accepts the flags Qt.Horizontal or Qt.Vertical.

pyqt sliders

If you want to add a slider to your existing code, don’t forget to import QSlider from PyQt5.QtWidgets.

 

Previous Post
Next Post

Leave a Reply