Here is the explanation for the preceding code:
- The first two steps are already familiar to the ones you have seen in preceding recipes.
- def update(): is the callback function for the slider widget. n=n_slider.value() gets the current value of the slider. Please note the difference in syntax from the other two GUIs in the preceding sections. The remaining three statements of this function are exactly the same as in the preceding recipes
- n_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) defines the slider widget of Qt and specifies that it should be plotted horizontally:
- n_slider.setRange(3, 10) specifies the minimum and maximum values for the slider
- n_slider.setSingleStep(1) specifies the size of each step when you drag ...