Qslider pyqt

# you need to import QSlider from PyQt5.QtWidgets first
from PyQt5.QtWidgets import QSlider

layout = QVBoxLayout() # or QHBoxLayout
slider = QSlider(Qt.Horizontal) # or Qt.Vertical
slider.setMinimum(10) # set min limit
slider.setMaximum(30) # set max limit
slider.setValue(20) # initiate value
slider.setTickPosition(QSlider.TicksBelow) # set the Ticks at below the slider
slider.setTickInterval(5) # set Tick Interval
layout.addWidget(slider) # finally add it to your layout

Here is what the above code is Doing:
1. Create a QVBoxLayout
2. Create a QSlider
3. Set the minimum value of the slider to 10
4. Set the maximum value of the slider to 30
5. Set the value of the slider to 20
6. Set the tick position to be below the slider
7. Set the tick interval to be 5
8. Add the slider to the layout