A possible solution is to use a QSS:
from PyQt5 import QtCore, QtWidgets
class TestWindow(QtWidgets.QWidget):
def __init__(self, parent=None):
super().__init__(parent)
self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.slider.setMinimumHeight(70)
lay = QtWidgets.QVBoxLayout(self)
lay.addWidget(self.slider)
lay.addStretch()
QSS = """
/* QSlider -------------------------------------- */
QSlider::groove:horizontal {
border-radius: 1px;
height: 3px;
margin: 0px;
background-color: rgb(52, 59, 72);
}
QSlider::groove:horizontal:hover {
background-color: rgb(55, 62, 76);
}
QSlider::handle:horizontal {
background-color: rgb(85, 170, 255);
border: none;
height: 40px;
width: 40px;
margin: -20px 0;
border-radius: 20px;
padding: -20px 0px;
}
QSlider::handle:horizontal:hover {
background-color: rgb(155, 180, 255);
}
QSlider::handle:horizontal:pressed {
background-color: rgb(65, 255, 195);
}
"""
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
app.setStyle("fusion")
app.setStyleSheet(QSS)
w = TestWindow()
w.show()
sys.exit(app.exec_())
