本文整理汇总了Python中PyQt5.QtWidgets.QProgressBar方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QProgressBar方法的具体用法?Python QtWidgets.QProgressBar怎么用?Python QtWidgets.QProgressBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QProgressBar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def _initUi(self):
"""初始化界面"""
self._progressTotal = QProgressBar(self)
self._logDescriptionLabel = QLabel()
self._logTimeLabel = QLabel()
self._logWarningLabel = QLabel()
self._logErrorLabel = QLabel()
self._logWarningLabel.setStyleSheet('color:#FF6100')
self._logErrorLabel.setStyleSheet('color:red')
grid = QGridLayout()
grid.addWidget(self._progressTotal, 0, 0)
grid.addWidget(self._logErrorLabel, 0, 1)
grid.addWidget(self._logWarningLabel, 0, 2)
grid.addWidget(self._logTimeLabel, 0, 3)
grid.addWidget(self._logDescriptionLabel, 0, 4)
self.setLayout(grid)
self._initMenu()
示例2: _initUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def _initUi(self):
"""初始化界面"""
self.setWindowTitle('进度')
labelTotal = QLabel('总体进度')
labelSingle = QLabel('个体进度')
self._progressSingle = QProgressBar(self)
self._progressTotal = QProgressBar(self)
vbox = QVBoxLayout()
vbox.addWidget(labelTotal)
vbox.addWidget(self._progressTotal)
vbox.addWidget(labelSingle)
vbox.addWidget(self._progressSingle)
vbox.addStretch()
self.setLayout(vbox)
示例3: singleDownload
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def singleDownload(self):
print('single')
row = self.downloadWidget.rowCount()
self.downloadWidget.setRowCount(row+1)
item = QTableWidgetItem(self.title)
self.downloadWidget.setItem(row, 0, item)
item = QTableWidgetItem('p{}'.format(self.page))
self.downloadWidget.setItem(row, 1, item)
item = QTableWidgetItem('0/{}'.format(self.slices))
self.downloadWidget.setItem(row, 2, item)
qpb = QProgressBar()
qpb.setValue(0)
self.downloadWidget.setCellWidget(row, 3, qpb)
# print(self.links)
t = Downloader(self.av, self.links)
self.row2qthread[row] = t
t.finish.connect(self.downloaded)
t.signal.connect(self.updateItem)
t.cur_slice.connect(self.updateItem)
t.start()
# print(int(t.currentThreadId()))
示例4: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def __init__(self, title='', mtime=0.5, parent=None):
"""
Initialize the form dialog.
:type title: str
:type mtime: float
:type parent: QWidget
"""
super().__init__(parent)
self.mtime = time() + mtime
self.progressBar = QtWidgets.QProgressBar(self)
self.progressBar.setAlignment(QtCore.Qt.AlignHCenter)
self.progressBar.setRange(0, 0)
self.progressBar.setFixedSize(300, 30)
self.progressBar.setTextVisible(True)
self.progressBar.setFormat(title or 'Busy ...')
self.mainLayout = QtWidgets.QVBoxLayout(self)
self.mainLayout.addWidget(self.progressBar)
self.setWindowIcon(QtGui.QIcon(':/icons/128/ic_eddy'))
self.setWindowTitle(title or 'Busy ...')
self.setFixedSize(self.sizeHint())
#############################################
# INTERFACE
#################################
示例5: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(350, 153)
self.progressBar = QtWidgets.QProgressBar(Dialog)
self.progressBar.setGeometry(QtCore.QRect(40, 60, 281, 23))
font = QtGui.QFont()
font.setPointSize(12)
self.progressBar.setFont(font)
self.progressBar.setProperty("value", 0)
self.progressBar.setObjectName("progressBar")
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(80, 20, 181, 21))
font = QtGui.QFont()
font.setPointSize(12)
self.label.setFont(font)
self.label.setObjectName("label")
self.pushButtonStart = QtWidgets.QPushButton(Dialog)
self.pushButtonStart.setGeometry(QtCore.QRect(80, 110, 151, 31))
font = QtGui.QFont()
font.setPointSize(12)
self.pushButtonStart.setFont(font)
self.pushButtonStart.setObjectName("pushButtonStart")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例6: to_raw
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def to_raw(self):
text = self.path_edit.toPlainText()
paths = text.splitlines()
movie_groups = io.get_movie_groups(paths)
n_movies = len(movie_groups)
if n_movies == 1:
text = "Converting 1 movie..."
else:
text = "Converting {} movies...".format(n_movies)
self.progress_dialog = QtWidgets.QProgressDialog(
text, "Cancel", 0, n_movies, self
)
progress_bar = QtWidgets.QProgressBar(self.progress_dialog)
progress_bar.setTextVisible(False)
self.progress_dialog.setBar(progress_bar)
self.progress_dialog.setMaximum(n_movies)
self.progress_dialog.setWindowTitle("Picasso: ToRaw")
self.progress_dialog.setWindowModality(QtCore.Qt.WindowModal)
self.progress_dialog.canceled.connect(self.cancel)
self.progress_dialog.closeEvent = self.cancel
self.worker = Worker(movie_groups)
self.worker.progressMade.connect(self.update_progress)
self.worker.finished.connect(self.on_finished)
self.worker.start()
self.progress_dialog.show()
示例7: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def setupUi(self, AnalysisProgress):
AnalysisProgress.setObjectName("AnalysisProgress")
AnalysisProgress.resize(594, 465)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(AnalysisProgress)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.progressBar = QtWidgets.QProgressBar(AnalysisProgress)
self.progressBar.setProperty("value", 0)
self.progressBar.setInvertedAppearance(False)
self.progressBar.setObjectName("progressBar")
self.verticalLayout.addWidget(self.progressBar)
self.textEdit = QtWidgets.QTextEdit(AnalysisProgress)
self.textEdit.setReadOnly(True)
self.textEdit.setObjectName("textEdit")
self.verticalLayout.addWidget(self.textEdit)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.retranslateUi(AnalysisProgress)
QtCore.QMetaObject.connectSlotsByName(AnalysisProgress)
示例8: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
layout = QVBoxLayout(self)
self.progressBar = QProgressBar(self)
self.progressBar.setRange(0, 100)
layout.addWidget(self.progressBar)
self.startButton = QPushButton('开启线程', self, clicked=self.onStart)
layout.addWidget(self.startButton)
self.suspendButton = QPushButton(
'挂起线程', self, clicked=self.onSuspendThread, enabled=False)
layout.addWidget(self.suspendButton)
self.resumeButton = QPushButton(
'恢复线程', self, clicked=self.onResumeThread, enabled=False)
layout.addWidget(self.resumeButton)
self.stopButton = QPushButton(
'终止线程', self, clicked=self.onStopThread, enabled=False)
layout.addWidget(self.stopButton)
# 当前线程id
print('main id', int(QThread.currentThreadId()))
# 子线程
self._thread = Worker(self)
self._thread.finished.connect(self._thread.deleteLater)
self._thread.valueChanged.connect(self.progressBar.setValue)
示例9: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
layout = QVBoxLayout(self)
self.progressBar = QProgressBar(self)
self.progressBar.setRange(0, 100)
layout.addWidget(self.progressBar)
layout.addWidget(QPushButton('开启线程', self, clicked=self.onStart))
# 当前线程id
print('main id', int(QThread.currentThreadId()))
# 启动线程更新进度条值
self._thread = QThread(self)
self._worker = Worker()
self._worker.moveToThread(self._thread) # 移动到线程中执行
self._thread.finished.connect(self._worker.deleteLater)
self._worker.valueChanged.connect(self.progressBar.setValue)
示例10: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def setupUi(self, ProgessBarWidget):
self.horizontalLayout = QtWidgets.QHBoxLayout(ProgessBarWidget)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.taskLabel = QtWidgets.QLabel(ProgessBarWidget)
self.taskLabel.setObjectName(_fromUtf8("taskLabel"))
bold_font = QtGui.QFont()
bold_font.setPointSize(13)
bold_font.setBold(True)
bold_font.setWeight(75)
self.taskLabel.setFont(bold_font)
self.horizontalLayout.addWidget(self.taskLabel)
self.waitBar = QtWidgets.QProgressBar(ProgessBarWidget)
self.waitBar.setObjectName(_fromUtf8("waitBar"))
self.horizontalLayout.addWidget(self.waitBar)
self.cancelButton = QtWidgets.QPushButton(ProgessBarWidget)
self.cancelButton.setObjectName(_fromUtf8("cancelButton"))
self.horizontalLayout.addWidget(self.cancelButton)
self.cancelButton.clicked.connect(self.cancel)
self.waitBar.setRange(0, 0)
示例11: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def __init__(self, player: 'MusicPlayer'): # noqa: F821
super().__init__()
self.player = player
self.player.positionChanged.connect(self.update_position)
self.setTextVisible(False)
self.setRange(0, 1000)
self.setFixedHeight(25)
self.dragging = False
self.setStyleSheet(
"""
QProgressBar {
margin: 10px;
height: 5px;
border: 0px solid #555;
border-radius: 2px;
background-color: #666;
}
QProgressBar::chunk {
background-color: white;
width: 1px;
}
"""
)
示例12: setProgressBar
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def setProgressBar(self):
self.progressBar = QtWidgets.QProgressBar(self)
self.progressBar.setValue(0)
self.progressBar.setVisible(False)
self.glHeadModel.loadStage.connect(self.updateProgressBar)
#Updates the progress bar using the signals (stage) from the glHeadModel
示例13: make_progress_bar
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def make_progress_bar(self, parent):
horizontalLayout_2 = QtWidgets.QHBoxLayout()
horizontalLayout_2.setObjectName("horizontalLayout_2")
self.loading_stat = QtWidgets.QLabel(parent)
horizontalLayout_2.addWidget(self.loading_stat)
self.progressbar_loading = QtWidgets.QProgressBar(parent)
horizontalLayout_2.addWidget(self.progressbar_loading)
self.stop_button = QtWidgets.QPushButton(parent)
self.stop_button.setMaximumSize(QtCore.QSize(50, 30))
self.stop_button.setText("stop")
horizontalLayout_2.addWidget(self.stop_button)
self.stop_button.clicked.connect(self.stop_button_clicked)
return horizontalLayout_2
示例14: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def setupUi(self, FileTransferDialog):
FileTransferDialog.setObjectName("FileTransferDialog")
FileTransferDialog.resize(400, 120)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(FileTransferDialog)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label = QtWidgets.QLabel(FileTransferDialog)
self.label.setObjectName("label")
self.verticalLayout_2.addWidget(self.label)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.progressBar = QtWidgets.QProgressBar(FileTransferDialog)
self.progressBar.setProperty("value", 24)
self.progressBar.setObjectName("progressBar")
self.verticalLayout.addWidget(self.progressBar)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.cancelButton = QtWidgets.QPushButton(FileTransferDialog)
self.cancelButton.setEnabled(False)
self.cancelButton.setCheckable(False)
self.cancelButton.setObjectName("cancelButton")
self.horizontalLayout.addWidget(self.cancelButton)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.retranslateUi(FileTransferDialog)
QtCore.QMetaObject.connectSlotsByName(FileTransferDialog)
示例15: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QProgressBar [as 别名]
def setupUi(self, ThreadFunDlg):
ThreadFunDlg.setObjectName("ThreadFunDlg")
ThreadFunDlg.setWindowModality(QtCore.Qt.NonModal)
ThreadFunDlg.resize(391, 101)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(ThreadFunDlg.sizePolicy().hasHeightForWidth())
ThreadFunDlg.setSizePolicy(sizePolicy)
ThreadFunDlg.setModal(True)
self.verticalLayout = QtWidgets.QVBoxLayout(ThreadFunDlg)
self.verticalLayout.setSpacing(3)
self.verticalLayout.setObjectName("verticalLayout")
self.lblText = QtWidgets.QLabel(ThreadFunDlg)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lblText.sizePolicy().hasHeightForWidth())
self.lblText.setSizePolicy(sizePolicy)
self.lblText.setText("")
self.lblText.setWordWrap(False)
self.lblText.setOpenExternalLinks(True)
self.lblText.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.lblText.setObjectName("lblText")
self.verticalLayout.addWidget(self.lblText)
self.progressBar = QtWidgets.QProgressBar(ThreadFunDlg)
self.progressBar.setProperty("value", 0)
self.progressBar.setInvertedAppearance(False)
self.progressBar.setObjectName("progressBar")
self.verticalLayout.addWidget(self.progressBar)
self.btnBox = QtWidgets.QDialogButtonBox(ThreadFunDlg)
self.btnBox.setOrientation(QtCore.Qt.Horizontal)
self.btnBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
self.btnBox.setCenterButtons(False)
self.btnBox.setObjectName("btnBox")
self.verticalLayout.addWidget(self.btnBox)
self.retranslateUi(ThreadFunDlg)
self.btnBox.accepted.connect(ThreadFunDlg.accept)
self.btnBox.rejected.connect(ThreadFunDlg.reject)
QtCore.QMetaObject.connectSlotsByName(ThreadFunDlg)