Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Created September 4, 2016 18:44
Show Gist options
  • Save manashmandal/57880da17f099c6154f0ad8bce67813f to your computer and use it in GitHub Desktop.
Save manashmandal/57880da17f099c6154f0ad8bce67813f to your computer and use it in GitHub Desktop.
from PyQt5.QtWidgets import QSlider, QDialog, QLabel, QHBoxLayout
from PyQt5.QtCore import Qt, pyqtSignal
class Slider_Dialog(QDialog):
def __init__(self):
super(Slider_Dialog, self).__init__()
self.init_ui()
def init_ui(self):
# Creating a label
self.sliderLabel = QLabel('Slider:', self)
# Creating a slider and setting its maximum and minimum value
self.slider = QSlider(self)
self.slider.setMinimum(0)
self.slider.setMaximum(100)
self.slider.setOrientation(Qt.Horizontal)
# Creating a horizontalBoxLayout
self.hboxLayout = QHBoxLayout(self)
# Adding the widgets
self.hboxLayout.addWidget(self.sliderLabel)
self.hboxLayout.addWidget(self.slider)
# Setting main layout
self.setLayout(self.hboxLayout)
self.setWindowTitle("Dialog with a Slider")
self.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment