def initUI(self): self.setWindowIcon(QIcon(SRC_DIR + "desc.ico")) self.lb_name = QLabel() self.lb_name.setText("文件夹名:") self.lb_name.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTrailing | Qt.AlignmentFlag.AlignVCenter) self.tx_name = QLineEdit() self.lb_desc = QLabel() self.tx_desc = QTextEdit() self.lb_desc.setText("描 述:") self.lb_desc.setAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTrailing | Qt.AlignmentFlag.AlignVCenter) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Orientation.Horizontal) self.buttonBox.setStandardButtons( QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("确定") self.buttonBox.button( QDialogButtonBox.StandardButton.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_name, 1, 0) self.grid.addWidget(self.tx_name, 1, 1) self.grid.addWidget(self.lb_desc, 2, 0) self.grid.addWidget(self.tx_desc, 2, 1, 5, 1) self.grid.addWidget(self.buttonBox, 7, 1, 1, 1) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject)
def setup_ui(self): self.setObjectName("Dialog") self.resize(497, 235) self.gridLayout = l = QGridLayout(self) l.setObjectName("gridLayout") self.icon_label = la = QLabel('') la.setMaximumSize(QSize(68, 68)) la.setScaledContents(False) la.setObjectName("icon_label") l.addWidget(la) self.msg = la = QLabel(self) la.setWordWrap(True), la.setMinimumWidth(400) la.setOpenExternalLinks(True) la.setObjectName("msg") l.addWidget(la, 0, 1, 1, 1) self.det_msg = dm = QPlainTextEdit(self) dm.setReadOnly(True) dm.setObjectName("det_msg") l.addWidget(dm, 1, 0, 1, 2) self.bb = bb = QDialogButtonBox(self) bb.setStandardButtons(QDialogButtonBox.StandardButton.Ok) bb.setObjectName("bb") bb.accepted.connect(self.accept) bb.rejected.connect(self.reject) l.addWidget(bb, 3, 0, 1, 2) self.toggle_checkbox = tc = QCheckBox(self) tc.setObjectName("toggle_checkbox") l.addWidget(tc, 2, 0, 1, 2)
def setUpWindow(self): """Set up the dialog's widgets and layout.""" header_label = QLabel("""<p style='color:#65888C'> Welcome to Database Manager</p>""") header_label.setFont(QFont("Arial", 24)) header_label.setAlignment(Qt.AlignmentFlag.AlignCenter) self.info_label = QLabel("""<p style='color:#65888C'> Sign into your account.</p>""") self.info_label.setAlignment(Qt.AlignmentFlag.AlignHCenter) username_label = QLabel("Username:"******"Password:"******"Log In", QDialogButtonBox.ButtonRole.AcceptRole) button_box.accepted.connect(self.clickedLogInButton) log_in_grid = QGridLayout() log_in_grid.addWidget(header_label, 0, 0, 1, 3, Qt.AlignmentFlag.AlignCenter) log_in_grid.addWidget(self.info_label, 1, 0, 1, 3, Qt.AlignmentFlag.AlignCenter) log_in_grid.addWidget(username_label, 2, 0) log_in_grid.addWidget(self.username_line, 2, 1) log_in_grid.addWidget(password_label, 3, 0) log_in_grid.addWidget(self.password_line, 3, 1) log_in_grid.addWidget(button_box, 4, 1) self.setLayout(log_in_grid)
class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): vbox = QVBoxLayout() btn = QPushButton('Dialog', self) btn.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) btn.move(20, 20) vbox.addWidget(btn) btn.clicked.connect(self.showDialog) self.lbl = QLabel('Knowledge only matters', self) self.lbl.move(130, 20) vbox.addWidget(self.lbl) self.setLayout(vbox) self.setGeometry(300, 300, 450, 350) self.setWindowTitle('Font dialog') self.show() def showDialog(self): font, ok = QFontDialog.getFont() if ok: self.lbl.setFont(font)
def __init__(self): super().__init__() self.statusBar = QStatusBar() self.restartProcessButton = QPushButton('START Myo Connect') self.iconLabel = QLabel() self.informationLabel = QLabel( 'App current information is displayed here...') self.left = int(self.screen().size().width() / 4) self.top = int(self.screen().size().height() / 4) self.width = 640 self.height = 450 self.title = 'Myo Exercises' if MyoService.check_if_process_running(): print("Myo Connect is running!") self.classifyExercises = ClassifyExercises( # subject="Ervin", # nr_of_samples=number_of_samples, epochs=300, # nr_of_gestures=4, exercises=PREDEFINED_EXERCISES, # batch_size=50, training_batch_size=16) else: self.classifyExercises = None # self.informationLabel.setText('Myo Connect is not running! Please start process.') self.table_widget = MainTabWidget(self) self.initUI() self.setStyleSheet("background-color: white;")
def questionPlayPageUI(self): layout = QFormLayout() self.questionPlayPage.titleDisplay = QLabel() layout.addRow(self.questionPlayPage.titleDisplay) self.questionPlayPage.contentDisplay = QLabel() layout.addRow(self.questionPlayPage.contentDisplay) self.questionPlayPage.choiceList = QListWidget() self.questionPlayPage.playerScores = QLabel() layout.addRow(self.questionPlayPage.choiceList, self.questionPlayPage.playerScores) self.questionPlayPage.chooseButton = QPushButton("&Submit") self.questionPlayPage.chooseButton.clicked.connect( self.submitPlayQuestion) layout.addRow(self.questionPlayPage.chooseButton) self.questionPlayPage.collapseButton = QPushButton("Collapse!") self.questionPlayPage.collapseButton.clicked.connect( self.goTo_CollapsePage) self.questionPlayPage.abortButton = QPushButton("Abort") self.questionPlayPage.abortButton.clicked.connect( self.abortGameInProgress) layout.addRow(self.questionPlayPage.collapseButton, self.questionPlayPage.abortButton) self.questionPlayPage.setLayout(layout)
def add_header_fields(self) -> None: layout: QLayout = QHBoxLayout() self.layout().addItem(layout) labels_layout: QLayout = QVBoxLayout() line_edits_layout: QLayout = QVBoxLayout() layout.addItem(labels_layout) layout.addItem(line_edits_layout) labels_layout.addWidget(QLabel("""Header File Name""", self)) labels_layout.addWidget( QLabel("""Output Path (relative to root of project)""", self)) line_edits_layout.addWidget(self.header_name_input) path_edit_layout: QLayout = QHBoxLayout() path_edit_layout.addWidget(self.header_output_path_input) path_edit_layout.addWidget(self.header_output_path_selector) path_edit_layout.setAlignment(self.header_output_path_selector, Qt.AlignmentFlag.AlignRight) self.header_output_path_selector.setFixedSize(QSize(25, 25)) line_edits_layout.addItem(path_edit_layout) self.header_output_path_selector.clicked.connect( lambda: self.open_path_selection_dialog())
def __init__(self): super(Window, self).__init__() self.groupBox = QGroupBox( "What is your favorite programming Language ?") self.groupBox.setFont(QFont("Sanserif", 13)) self.checkBox1 = QCheckBox("Python") self.checkBox1.setIcon(QIcon("")) self.checkBox1.setWhatsThis("This is a checkbox of Python") self.checkBox2 = QCheckBox("C++") self.checkBox2.setIcon(QIcon("")) self.checkBox1.setWhatsThis("This is a checkbox of C++") self.checkBox3 = QCheckBox("Java") self.checkBox3.setIcon(QIcon("")) self.checkBox1.setWhatsThis("This is a checkbox of Java") self.label = QLabel("You Have Selected FootBall") self.title = " " self.left = 100 self.top = 200 self.width = 400 self.height = 300 self.InitWindow()
def __init__(self): super().__init__() self.setWindowTitle("File Hash Checker") self.setGeometry(0, 0, 600, 300) self.labelFileDropper = FileDropper("Datei auswählen") #self.selectFileButton.clicked.connect(self.get_file_to_check) self.labelFileDropper.setAcceptDrops(True) self.labelFileDropper.setStyleSheet( "border: 1px solid black; border-radius: 15px; text-align: center; " "height: 200px") self.labelFileDropper.move(0, 0) self.labelFileDropper.resize(500, 150) self.labelMD5Hash = QLabel( "Bitte zu vergleichenden MD5 Hash eingeben:") self.textMD5Hash = QLineEdit() self.buttonCompareMD5 = QPushButton('MD5 Vergleichen') self.buttonCompareMD5.clicked.connect(self.compare_md5) self.labelIsSame = QLabel() layout = QVBoxLayout() layout.addWidget(self.labelFileDropper) layout.addWidget(self.labelMD5Hash) layout.addWidget(self.textMD5Hash) layout.addWidget(self.buttonCompareMD5) layout.addWidget(self.labelIsSame) self.setLayout(layout)
class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) self.lastY = 0 self.image = QImage(2080, 1, QImage.Format.Format_Grayscale8) self.label = QLabel(self) self.resize (2080, 500) def updateImage(self, x, y, c): if not self.lastY == y: self.image = self.image.copy(0, 0, 2080, y+1) self.lastY = y self.image.setPixelColor(x,y,QColor(c,c,c)) def refreshImage(self): pixmap = QPixmap.fromImage(self.image) self.label.setPixmap(pixmap) self.setCentralWidget(self.label) def saveImage(self): name = time.strftime("%Y %m %d-%H %M %S") self.image.save('NOAA ' + str(name) + '.png')
def initGui(self): self.setWindowTitle('My Application!!!') self.setFixedSize(600, 400) #self.showFullScreen() # Label self.lbl_saludo = QLabel('Bienvenido...', self) self.lbl_saludo.move(50, 50) # Menu self.menu_principal = self.menuBar() self.menu_archivo = self.menu_principal.addMenu('Archivo') self.menu_operaciones = self.menu_principal.addMenu('Operaciones') self.menu_ayuda = self.menu_principal.addMenu('Ayuda') # Archivo self.menu_item_salir = QAction('Salir', self) self.menu_item_salir.setShortcut('⌘D') self.menu_item_salir.triggered.connect(self.close) self.menu_archivo.addAction(self.menu_item_salir) # Operaciones self.menu_item_operaciones = QAction('Operaciones', self) self.menu_operaciones.addAction(self.menu_item_operaciones) # Ayuda self.menu_acerca_de = QAction('Acerca de MY Application.', self) self.menu_ayuda.addAction(self.menu_acerca_de) self.menu_ayuda.triggered.connect(self.mostrar_acerca_de)
class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): grid = QGridLayout() x = 0 y = 0 self.text = f'x: {x}, y: {y}' self.label = QLabel(self.text, self) grid.addWidget(self.label, 0, 0, Qt.AlignmentFlag.AlignTop) self.setMouseTracking(True) self.setLayout(grid) self.setGeometry(300, 300, 450, 300) self.setWindowTitle('Event object') self.show() def mouseMoveEvent(self, e): x = int(e.position().x()) y = int(e.position().y()) text = f'x: {x}, y: {y}' self.label.setText(text)
def initUI(self): title = QLabel('Title') author = QLabel('Author') review = QLabel('Review') titleEdit = QLineEdit() authorEdit = QLineEdit() reviewEdit = QTextEdit() grid = QGridLayout() grid.setSpacing(10) grid.addWidget(title, 1, 0) grid.addWidget(titleEdit, 1, 1) grid.addWidget(author, 2, 0) grid.addWidget(authorEdit, 2, 1) grid.addWidget(review, 3, 0) grid.addWidget(reviewEdit, 3, 1, 5, 1) self.setLayout(grid) self.setGeometry(300, 300, 350, 300) self.setWindowTitle('Review') self.show()
class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): vbox = QVBoxLayout(self) cal = QCalendarWidget(self) cal.setGridVisible(True) cal.clicked[QDate].connect(self.showDate) vbox.addWidget(cal) self.lbl = QLabel(self) date = cal.selectedDate() self.lbl.setText(date.toString()) vbox.addWidget(self.lbl) self.setLayout(vbox) self.setGeometry(300, 300, 350, 300) self.setWindowTitle('Calendar') self.show() def showDate(self, date): self.lbl.setText(date.toString())
def __init__(self, interactive_matching_widget): super(NuggetListWidget, self).__init__(interactive_matching_widget) self.interactive_matching_widget = interactive_matching_widget self.layout = QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(10) # top widget self.top_widget = QWidget() self.top_layout = QHBoxLayout(self.top_widget) self.top_layout.setContentsMargins(0, 0, 0, 0) self.top_layout.setSpacing(10) self.layout.addWidget(self.top_widget) self.description = QLabel( "Below you see a list of guessed matches for you to confirm or correct." ) self.description.setFont(LABEL_FONT) self.top_layout.addWidget(self.description) self.stop_button = QPushButton("Continue With Next Attribute") self.stop_button.setFont(BUTTON_FONT) self.stop_button.clicked.connect(self._stop_button_clicked) self.stop_button.setMaximumWidth(240) self.top_layout.addWidget(self.stop_button) # nugget list self.nugget_list = CustomScrollableList(self, NuggetListItemWidget) self.layout.addWidget(self.nugget_list)
class CurrentStateBox(QWidget): def __init__( self, state: str, parent: Optional[QWidget] = None, *args: Tuple[Any, Any], **kwargs: Tuple[Any, Any], ) -> None: """ The horizontal box of the current state of the solver. """ super(CurrentStateBox, self).__init__(parent=parent, *args, **kwargs) self.setContentsMargins(0, 0, 0, 0) layout = QHBoxLayout() # add "State: " label to layout: layout.addWidget(QLabel("State: ")) # create current state label and add to layout: self.__currentStateLabel = QLabel(state) layout.addWidget(self.__currentStateLabel) self.setLayout(layout) def onStateChange(self, state: str) -> None: self.__currentStateLabel.setText(state)
def __init__( self, parent: Optional[QWidget] = None, *args: Tuple[Any, Any], **kwargs: Tuple[Any, Any], ) -> None: """ The log layout consisting of, for each command: Left: Command name Right: Command result """ super(VerticalLogLayout, self).__init__(parent=parent, *args, **kwargs) # set layout and add placeholder layouts to ensure they aren't automatically destroyed later layout = QHBoxLayout() self.__commandNames.append("Command name") self.__commandResults.append("Result") commandNamesBox = QVBoxLayout() commandResultsBox = QVBoxLayout() # add the human descriptions text to the layouts for i in range(0, len(self.__commandNames)): commandNamesBox.addWidget(QLabel(self.__commandNames[i])) commandResultsBox.addWidget(QLabel(self.__commandResults[i])) layout.addLayout(commandNamesBox) layout.addLayout(commandResultsBox) # remember to set the layout! self.setLayout(layout)
class Window(QDialog): def __init__(self): super(Window, self).__init__() self.groupBox = QGroupBox("What is your favorite sport ?") self.radiobtn3 = QRadioButton("BasketBall") self.radiobtn3.setIcon(QIcon("")) self.radiobtn2 = QRadioButton("Swimming") self.radiobtn2.setIcon(QIcon("")) self.radiobtn1 = QRadioButton("FootBall") self.radiobtn1.setIcon(QIcon("")) self.label = QLabel("You Have Selected FootBall") self.title = " " self.left = 100 self.top = 200 self.width = 400 self.height = 300 self.InitWindow() def InitWindow(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.radioButton() vbox = QVBoxLayout() vbox.addWidget(self.groupBox) vbox.addWidget(self.label) self.setLayout(vbox) self.show() def radioButton(self): hbox = QHBoxLayout() self.radiobtn1.setChecked(True) self.radiobtn1.toggled.connect(self.OnRadioButton) hbox.addWidget(self.radiobtn1) self.radiobtn2.setChecked(False) self.radiobtn2.toggled.connect(self.OnRadioButton) hbox.addWidget(self.radiobtn2) self.radiobtn3.setChecked(False) self.radiobtn2.toggled.connect(self.OnRadioButton) hbox.addWidget(self.radiobtn3) self.groupBox.setLayout(hbox) def OnRadioButton(self): # Which radioBtn send message radioBtn = self.sender() if radioBtn.isChecked(): self.label.setText("You Have Selected " + radioBtn.text())
def __init__(self): super(MainWindow, self).__init__() self.title = "Image Viewer" self.setWindowTitle(self.title) self.lastY = 0 self.image = QImage(2080, 1, QImage.Format.Format_Grayscale8) self.label = QLabel(self) self.resize (2080, 500)
def __init__(self, label1=None, label2=None): super().__init__() self.label = QLabel(label1) self.label.setStyleSheet(self.labelSheet) self.value = QLabel(label2) self.value.setStyleSheet(self.valSheet) self.addWidget(self.label) self.addWidget(self.value) self.label.setAlignment(Qt.AlignmentFlag.AlignRight) self.value.setAlignment(Qt.AlignmentFlag.AlignLeft)
def initUI(self) -> None: self.setGeometry(0, 0, self.width, self.height) self.setWindowTitle('Message box') label = QLabel(self) pixmap = QPixmap(self.file_name) label.setPixmap(pixmap) self.resize(pixmap.width(),pixmap.height()) self.show()
def __init__(self): super(FixedSlider,self).__init__() self.setTickInterval(1) self.value_label=QLabel(self) self.value_label.setFixedSize(40,20) self.value_label.setAutoFillBackground(True) self.value_label.setStyleSheet("QLabel{background:transparent;font:8px}") self.value_label.setAlignment(Qt.Alignment.AlignCenter) self.value_label.setVisible(False) self.value_label.move(0,-5)
def setUpMainWindow(self): """Set up the application's main window and widgets.""" self.movie = QMovie() # Create movie object self.media_label = QLabel() # Create label to place images/GIFs on self.media_label.setPixmap(QPixmap("icons/image_label.png")) self.media_label.setFrameShape(QFrame.Shape.StyledPanel) self.media_label.setAlignment(Qt.AlignmentFlag.AlignCenter) self.setCentralWidget(self.media_label)
def __init__( self, parent=None, buttons=None, exercises=None, index: int = None, ): super(ChangeKeyDialog, self).__init__(parent) layout = QVBoxLayout(self) self.setLayout(layout) widget = QWidget() keyLayout = QVBoxLayout() widget.setStyleSheet(""" QWidget{ border-radius: 12px; border: 1px solid grey; background-color: #b5b5b5; color: white; font-size: 40px; } """) # widget.setFixedSize(100, 100) self.currentKeyLabel = QLabel('W') keyLayout.addWidget(self.currentKeyLabel) keyLayout.setAlignment(self.currentKeyLabel, Qt.Alignment.AlignCenter) widget.setLayout(keyLayout) label = QLabel("Press a key to swap") emptyKey = QPushButton('Use empty slot') emptyKey.setFocusPolicy(Qt.FocusPolicy.ClickFocus) emptyKey.clicked.connect(self.useEmpty) acceptKey = QPushButton('Accept') acceptKey.clicked.connect(self.accept) acceptKey.setFocusPolicy(Qt.FocusPolicy.ClickFocus) layout.addWidget(label) layout.addWidget(widget) actions = QHBoxLayout() actions.addWidget(emptyKey) actions.addWidget(acceptKey) layout.addLayout(actions) layout.setAlignment(widget, Qt.Alignment.AlignCenter) self.buttons = buttons self.exercises = exercises self.index = index self.monitor = KeyMonitor() self.monitor.start_monitoring() self.currentKey = self.monitor.currentKey self.timer = QTimer() self.timer.timeout.connect(self.onTimeout) self.timer.start() print("Dialog init done!")
def show_update(self, ver, msg): self.lb_new_ver = QLabel("新版") # 检测新版 self.lb_new_ver_msg = QLabel() self.lb_new_ver_msg.setOpenExternalLinks(True) self.lb_new_ver_msg.setWordWrap(True) if ver != '0': self.lb_name_text.setText(f"{self._ver} ➡ {ver}") self.lb_new_ver_msg.setText(msg) self.lb_new_ver_msg.setMinimumWidth(700) if self.form.rowCount() < 5: self.form.insertRow(1, self.lb_new_ver, self.lb_new_ver_msg)
def __init__(self): super().__init__() self.setWindowTitle('LazyDictionary') self.setWindowIcon(QIcon('book.png')) self.setFixedHeight(100) self.setFixedWidth(300) self.label = QLabel('word count: 0', self) self.label.setFont(QFont('san serif', 15)) self.label.move(90, 0) self.button() self.oneClick = True
def __init__(self): super(MainWidget, self).__init__() self.resize(500, 600) self.setWindowTitle("喜马拉雅下载 by[Zero] " + __VERSION__) self.mainlayout = QVBoxLayout() self.setLayout(self.mainlayout) self.groupbox = QGroupBox("选择类型") self.groupbox.setFixedHeight(50) hlayout = QHBoxLayout(self.groupbox) self.signal_m4a = QRadioButton("单个下载") self.mut_m4a = QRadioButton("专辑下载") self.vip_signal_m4a = QRadioButton("VIP单个下载") self.vip_m4a = QRadioButton("VIP专辑下载") hlayout.addWidget(self.signal_m4a) hlayout.addWidget(self.mut_m4a) hlayout.addWidget(self.vip_signal_m4a) hlayout.addWidget(self.vip_m4a) self.mainlayout.addWidget(self.groupbox) frame01 = QFrame(self) child_layout = QVBoxLayout() print(self.width()) label01 = QLabel("链 接", self) label02 = QLabel("下载目录", self) self.url_lineedit = QLineEdit(self) self.dir_lineedit = QLineEdit(self) hlayout01 = QHBoxLayout() hlayout01.addWidget(label01, 1) hlayout01.addWidget(self.url_lineedit, 9) hlayout02 = QHBoxLayout() hlayout02.addWidget(label02, 1) hlayout02.addWidget(self.dir_lineedit, 9) child_layout.addLayout(hlayout01) child_layout.addLayout(hlayout02) child_layout.setContentsMargins( 5, 0, 5, 0) #(int left, int top, int right, int bottom) frame01.setLayout(child_layout) self.download_progressbar = QProgressBar() self.download_progressbar.setAlignment( QtCore.Qt.Alignment.AlignCenter) #文字居中 self.download_progressbar.setValue(88) self.download_btn = QPushButton("开始下载") self.show_plaintextedit = QPlainTextEdit() self.show_plaintextedit.setMinimumHeight(400) self.mainlayout.addWidget(frame01) self.mainlayout.addWidget(self.download_progressbar) self.mainlayout.addWidget(self.download_btn) self.mainlayout.addWidget(self.show_plaintextedit) self.mainlayout.addStretch() ### 设置stylesheet self.download_btn.setStyleSheet( 'QPushButton:pressed{ text-align: center;background-color:red;}')
def __init__(self, main_window_content, sub_header_text): super(MainWindowContentSection, self).__init__() self.main_window_content = main_window_content self.layout = QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setAlignment(Qt.AlignmentFlag.AlignTop) self.layout.setSpacing(10) self.sub_header = QLabel(sub_header_text) self.sub_header.setFont(SUBHEADER_FONT) self.layout.addWidget(self.sub_header)
def __init__(self, main_window, header_text): super(MainWindowContent, self).__init__() self.main_window = main_window self.layout = QVBoxLayout(self) self.layout.setContentsMargins(10, 5, 10, 5) self.layout.setAlignment(Qt.AlignmentFlag.AlignTop) self.layout.setSpacing(20) self.header = QLabel(header_text) self.header.setFont(HEADER_FONT) self.layout.addWidget(self.header)
def make_slider(MAX_RANGE, INIT_VALUE): label = QLabel("") label.setAlignment(Qt.AlignmentFlag.AlignCenter) slider = QSlider(orientation=Qt.Orientation.Horizontal) slider.setRange(0, SLIDER_MAX_RANGE_INT) slider.setValue(int(SLIDER_MAX_RANGE_INT*(INIT_VALUE/MAX_RANGE))) slider.setTickPosition(QSlider.TickPosition.TicksBelow) slider.setTickInterval(int(SLIDER_MAX_RANGE_INT*0.1)) slider.setSingleStep(1) return slider, label