{"id":5038,"date":"2022-09-22T07:12:00","date_gmt":"2022-09-22T07:12:00","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=5038"},"modified":"2022-10-29T07:59:50","modified_gmt":"2022-10-29T07:59:50","slug":"pyqt-qslider","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/pyqt\/pyqt-qslider\/","title":{"rendered":"PyQt QSlider"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the PyQt <code>QSlider<\/code> class to create a slider widget.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-pyqt-qslider'>Introduction to the PyQt QSlider <a href=\"#introduction-to-the-pyqt-qslider\" class=\"anchor\" id=\"introduction-to-the-pyqt-qslider\" title=\"Anchor for Introduction to the PyQt QSlider\">#<\/a><\/h2>\n\n\n\n<p>A slider is a widget for controlling a bounded value. A slider allows you to move a handle along a horizontal or vertical groove. A slider translates the position of the handle into an integer within a valid range.<\/p>\n\n\n\n<p>To create a slider, you use the PyQt <code>QSlider<\/code> class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">QSlider(orientation&#91;, parent=<span class=\"hljs-literal\">None<\/span>])<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>QSlider<\/code> accepts two arguments:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>Orientation<\/code> specifies the orientation of the slider. The valid values are <code>Qt.Orientation.Vertical<\/code> and <code>Qt.Orientation.Horizontal<\/code>.<\/li><li><code>Parent<\/code> is the parent widget of the slider.<\/li><\/ul>\n\n\n\n<p>For example, the following creates a horizontal slider:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider = QSlider(Qt.Orientation.Horizontal, self)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"381\" height=\"40\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Horizontal-Slider.png\" alt=\"\" class=\"wp-image-5039\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Horizontal-Slider.png 381w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Horizontal-Slider-300x31.png 300w\" sizes=\"auto, (max-width: 381px) 100vw, 381px\" \/><\/figure>\n\n\n\n<p>And the following creates a vertical slider:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider = QSlider(Qt.Orientation.Vertical, self)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"41\" height=\"159\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Vertical-Slider.png\" alt=\"\" class=\"wp-image-5040\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id='range'>Range <a href=\"#range\" class=\"anchor\" id=\"range\" title=\"Anchor for Range\">#<\/a><\/h3>\n\n\n\n<p>To set the range of values for the slider, you use the <code>setRange()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.setRange(min,max)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Also, you can set the <code>setMinimum()<\/code> or <code>setMaximum()<\/code> methods:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.setMinimum(min)\nslider.setMaximum(max)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='single-step'>Single step <a href=\"#single-step\" class=\"anchor\" id=\"single-step\" title=\"Anchor for Single step\">#<\/a><\/h3>\n\n\n\n<p>When you press the up\/down or left\/right arrow key, the handle of the slider will increment\/decrement a single step. <\/p>\n\n\n\n<p>To set the single step, you use the <code>setSingleStep()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.setSingleStep(step)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='page-step'>Page step <a href=\"#page-step\" class=\"anchor\" id=\"page-step\" title=\"Anchor for Page step\">#<\/a><\/h3>\n\n\n\n<p>If you press the page up \/ page down key, the handle of the slider will increment\/decrement a page step. To set a page step, you use the <code>setPageStep()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.setPageStep(pageStep)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='setting-the-current-value'>Setting the current value <a href=\"#setting-the-current-value\" class=\"anchor\" id=\"setting-the-current-value\" title=\"Anchor for Setting the current value\">#<\/a><\/h3>\n\n\n\n<p>To set a value for the slider, you use the <code>setValue()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.setValue(value)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>value()<\/code> method returns the current value of the slider:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">current_value = slider.value()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='displaying-tick-marks'>Displaying tick marks <a href=\"#displaying-tick-marks\" class=\"anchor\" id=\"displaying-tick-marks\" title=\"Anchor for Displaying tick marks\">#<\/a><\/h3>\n\n\n\n<p>By default, a slider doesn&#8217;t have tick marks. To show the tick marks, you use the <code>set<code>TickPosition<\/code>()<\/code> method. The <code>setTickPosition<\/code> sets the <code>TickPosition<\/code> property to a value.<\/p>\n\n\n\n<p>The horizontal slider has two options:<\/p>\n\n\n\n<p>The <code>QSlider.TicksAbove<\/code> &#8211; shows tick marks above the slider:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"284\" height=\"50\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-TicksAbove.png\" alt=\"\" class=\"wp-image-5041\"\/><\/figure>\n\n\n\n<p>The <code>QSlider.TicksBelow<\/code> &#8211; shows tick marks below the slider.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"285\" height=\"47\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-TicksBelow.png\" alt=\"\" class=\"wp-image-5042\"\/><\/figure>\n\n\n\n<p>The vertical slider also has two options:<\/p>\n\n\n\n<p>The <code>QSlider.TicksLeft<\/code> &#8211; shows the tick marks on the left of the slider:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"46\" height=\"146\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Vertical-Slider-TicksLeft.png\" alt=\"\" class=\"wp-image-5043\"\/><\/figure>\n\n\n\n<p>The <code>QSlider.TicksRight<\/code> &#8211; shows the tick marks on the right of the slider:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"49\" height=\"138\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Vertical-Slider-TicksRight.png\" alt=\"\" class=\"wp-image-5044\"\/><\/figure>\n\n\n\n<p>The <code>QSlider.TicksBothSides<\/code> shows the tick marks on both sides of the groove:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"61\" height=\"150\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Vertical-Slider-TicksBothSides.png\" alt=\"\" class=\"wp-image-5045\"\/><\/figure>\n\n\n\n<p>By default, the <code>TickPosition<\/code> is <code>QSlider<\/code>.NoTicks that do not display any tick marks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='setting-interval'>Setting interval <a href=\"#setting-interval\" class=\"anchor\" id=\"setting-interval\" title=\"Anchor for Setting interval\">#<\/a><\/h3>\n\n\n\n<p>To set the interval between tick marks, you use the <code>setTickInteral()<\/code> method. By default, the ticket interval is zero.<\/p>\n\n\n\n<p>If the tick interval is zero, the slider will choose between <code>singleStep<\/code> and <code>pageStep<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='signals'>Signals <a href=\"#signals\" class=\"anchor\" id=\"signals\" title=\"Anchor for Signals\">#<\/a><\/h3>\n\n\n\n<p>The <code>QSlider<\/code> has some signals but the most important one is <code>valueChanged<\/code>. The <code>QSlider<\/code> emits the <code>valueChanged<\/code> signal whenever the value of the slider changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='pyqt-qslider-example'>PyQt QSlider example <a href=\"#pyqt-qslider-example\" class=\"anchor\" id=\"pyqt-qslider-example\" title=\"Anchor for PyQt QSlider example\">#<\/a><\/h2>\n\n\n\n<p>The following program uses the <code>QSlider<\/code> class to create a slider. A label displays the current value of the slider.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> sys\n<span class=\"hljs-keyword\">from<\/span> PyQt6.QtWidgets <span class=\"hljs-keyword\">import<\/span> QApplication, QWidget, QSlider, QLabel, QFormLayout\n<span class=\"hljs-keyword\">from<\/span> PyQt6.QtCore <span class=\"hljs-keyword\">import<\/span> Qt\n\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">MainWindow<\/span><span class=\"hljs-params\">(QWidget)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, *args, **kwargs)<\/span>:<\/span>\n        super().__init__(*args, **kwargs)\n\n        self.setWindowTitle(<span class=\"hljs-string\">'PyQt QSlider'<\/span>)\n        self.setMinimumWidth(<span class=\"hljs-number\">200<\/span>)\n\n        <span class=\"hljs-comment\"># create a grid layout<\/span>\n        layout = QFormLayout()\n        self.setLayout(layout)\n\n        slider = QSlider(Qt.Orientation.Horizontal, self)\n        slider.setRange(<span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">100<\/span>)\n        slider.setValue(<span class=\"hljs-number\">50<\/span>)\n        slider.setSingleStep(<span class=\"hljs-number\">5<\/span>)\n        slider.setPageStep(<span class=\"hljs-number\">10<\/span>)\n        slider.setTickPosition(QSlider.TickPosition.TicksAbove)\n\n        slider.valueChanged.connect(self.update)\n\n        self.result_label = QLabel(<span class=\"hljs-string\">''<\/span>, self)\n\n        layout.addRow(slider)\n        layout.addRow(self.result_label)\n\n        <span class=\"hljs-comment\"># show the window<\/span>\n        self.show()\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">update<\/span><span class=\"hljs-params\">(self, value)<\/span>:<\/span>\n        self.result_label.setText(<span class=\"hljs-string\">f'Current Value: <span class=\"hljs-subst\">{value}<\/span>'<\/span>)\n\n\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">'__main__'<\/span>:\n    app = QApplication(sys.argv)\n    window = MainWindow()\n    sys.exit(app.exec())<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"377\" height=\"140\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Example.png\" alt=\"\" class=\"wp-image-5049\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Example.png 377w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/PyQt-QSlider-Example-300x111.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/figure>\n\n\n\n<p>How it works.<\/p>\n\n\n\n<p>First, create a <code>QSlider<\/code> object:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider = QSlider(Qt.Orientation.Horizontal, self)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Next, set the range, value, single step, page step, and tick position:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.setRange(<span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">100<\/span>)\nslider.setValue(<span class=\"hljs-number\">50<\/span>)\nslider.setSingleStep(<span class=\"hljs-number\">10<\/span>)\nslider.setPageStep(<span class=\"hljs-number\">20<\/span>)\nslider.setTickPosition(QSlider.TickPosition.TicksAbove)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Then, connect to the <code>valueChanged()<\/code> signal to the <code>update()<\/code> method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">slider.valueChanged.connect(self.update)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>After that, create a <code><a href=\"https:\/\/www.pythontutorial.net\/pyqt\/pyqt-qlabel\/\">QLabel<\/a><\/code> object that will display the current value of the slider whenever the slider&#8217;s value changes:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">self.result_label = QLabel(<span class=\"hljs-string\">''<\/span>, self)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, define the <code>update()<\/code> method that changes the text of the <code>QLabel<\/code> to the current value of the slider:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">update<\/span><span class=\"hljs-params\">(self, value)<\/span>:<\/span>\n    self.result_label.setText(<span class=\"hljs-string\">f'Current Value: <span class=\"hljs-subst\">{value}<\/span>'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Use the PyQt <code>QSlider<\/code> widget to create a slider.<\/li><li>Connect to the <code>valueChanged<\/code> signal to update the slider&#8217;s value.<\/li><\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"5038\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/pyqt\/pyqt-qslider\/\"\n\t\t\t\tdata-post-title=\"PyQt QSlider\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"5038\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/pyqt\/pyqt-qslider\/\"\n\t\t\t\tdata-post-title=\"PyQt QSlider\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to use the PyQt QSlider to create a slider widget including vertical &#038; horizontal sliders.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":4862,"menu_order":16,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5038","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/5038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=5038"}],"version-history":[{"count":0,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/5038\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4862"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=5038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}