class Dialog(QtWidgets.QDialog): def __init__(self, parent=None): QtWidgets.QDialog.__init__(self, parent) mainLayout = QtWidgets.QVBoxLayout() self.setWindowTitle("PyQtLineEditProgressBar Behaviors") self.lineedit1 = PyQtLineEditProgressBar( behavior=pqtpbar.STARTS_EMPTY_FILLS_LEFT_TO_RIGHT) self.lineedit1.setAlignment(QtCore.Qt.AlignCenter) self.lineedit1.setText(self.lineedit1.getBehavior().upper().replace( '-', '_')) self.lineedit2 = PyQtLineEditProgressBar( behavior=pqtpbar.STARTS_EMPTY_FILLS_RIGHT_TO_LEFT) self.lineedit2.setAlignment(QtCore.Qt.AlignCenter) self.lineedit2.setText(self.lineedit2.getBehavior().upper().replace( '-', '_')) self.lineedit3 = PyQtLineEditProgressBar( behavior=pqtpbar.STARTS_FULL_EMPTIES_LEFT_TO_RIGHT) self.lineedit3.setAlignment(QtCore.Qt.AlignCenter) self.lineedit3.setText(self.lineedit3.getBehavior().upper().replace( '-', '_')) self.lineedit4 = PyQtLineEditProgressBar( behavior=pqtpbar.STARTS_FULL_EMPTIES_RIGHT_TO_LEFT) self.lineedit4.setAlignment(QtCore.Qt.AlignCenter) self.lineedit4.setText(self.lineedit4.getBehavior().upper().replace( '-', '_')) mainLayout.addWidget(self.lineedit1) mainLayout.addWidget(self.lineedit2) mainLayout.addWidget(self.lineedit3) mainLayout.addWidget(self.lineedit4) button = QtWidgets.QPushButton('The Four Behaviors') button.clicked.connect(self.buttonClicked) mainLayout.addWidget(button) self.setLayout(mainLayout) def buttonClicked(self): self.lineedit1.updateProgress(0.1) #self.lineedit1.setText(self.lineedit1.getBehavior()) self.lineedit2.updateProgress(0.1) #self.lineedit2.setText(self.lineedit2.getBehavior()) self.lineedit3.updateProgress(0.1) #self.lineedit3.setText(self.lineedit3.getBehavior()) self.lineedit4.updateProgress(0.1) #self.lineedit4.setText(self.lineedit4.getBehavior()) time.sleep(0.5)
class Dialog(QtWidgets.QDialog): def __init__(self, parent=None): QtWidgets.QDialog .__init__(self, parent) mainLayout = QtWidgets.QVBoxLayout() self.setWindowTitle("PyQtLineEditProgressBar Demo") self.lineedit1 = PyQtLineEditProgressBar() self.lineedit1.setAlignment(QtCore.Qt.AlignCenter) #self.lineedit1.setSizePolicy() self.lineedit1.setText(self.lineedit1.getBehavior()) self.lineedit2 = PyQtLineEditProgressBar(behavior=pqtpbar.STARTS_EMPTY_FILLS_RIGHT_TO_LEFT, progressbar_color=pqtpbar.DEFAULT_COLOR_RED) self.lineedit2.setAlignment(QtCore.Qt.AlignCenter) self.lineedit2.setText(self.lineedit2.getBehavior()) self.lineedit3 = PyQtLineEditProgressBar(behavior=pqtpbar.STARTS_FULL_EMPTIES_LEFT_TO_RIGHT, progressbar_color=pqtpbar.DEFAULT_COLOR_ORANGE) self.lineedit3.setAlignment(QtCore.Qt.AlignCenter) self.lineedit3.setText(self.lineedit3.getBehavior()) self.lineedit4 = PyQtLineEditProgressBar(behavior=pqtpbar.STARTS_FULL_EMPTIES_RIGHT_TO_LEFT, progressbar_color=pqtpbar.DEFAULT_COLOR_BLUE) self.lineedit4.setAlignment(QtCore.Qt.AlignCenter) self.lineedit4.setText(self.lineedit4.getBehavior()) self.lineedit5 = PyQtLineEditProgressBar(progressbar_color=pqtpbar.DEFAULT_COLOR_YELLOW) self.lineedit5.setAlignment(QtCore.Qt.AlignCenter) self.lineedit5.setText(self.lineedit5.getBehavior()) self.lineedit6 = PyQtLineEditProgressBar(behavior=pqtpbar.STARTS_EMPTY_FILLS_RIGHT_TO_LEFT, progressbar_color=pqtpbar.DEFAULT_COLOR_PURPLE) self.lineedit6.setAlignment(QtCore.Qt.AlignCenter) self.lineedit6.setText(self.lineedit6.getBehavior()) mainLayout.addWidget(self.lineedit1) mainLayout.addWidget(self.lineedit2) mainLayout.addWidget(self.lineedit3) mainLayout.addWidget(self.lineedit4) mainLayout.addWidget(self.lineedit5) mainLayout.addWidget(self.lineedit6) button = QtWidgets.QPushButton('Update Progress') button.clicked.connect(self.buttonClicked) mainLayout.addWidget(button) self.setLayout(mainLayout) def buttonClicked(self): self.lineedit1.updateProgress(0.1) #self.lineedit1.setText(self.lineedit1.getBehavior()) self.lineedit2.updateProgress(0.1) #self.lineedit2.setText(self.lineedit2.getBehavior()) self.lineedit3.updateProgress(0.1) #self.lineedit3.setText(self.lineedit3.getBehavior()) self.lineedit4.updateProgress(0.1) #self.lineedit4.setText(self.lineedit4.getBehavior()) self.lineedit5.updateProgress(0.1) #self.lineedit5.setText(self.lineedit5.getBehavior()) self.lineedit6.updateProgress(0.1) #self.lineedit6.setText(self.lineedit6.getBehavior()) time.sleep(0.5)