本文整理匯總了Python中qgis.PyQt.QtWidgets.QProgressBar.show方法的典型用法代碼示例。如果您正苦於以下問題:Python QProgressBar.show方法的具體用法?Python QProgressBar.show怎麽用?Python QProgressBar.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qgis.PyQt.QtWidgets.QProgressBar
的用法示例。
在下文中一共展示了QProgressBar.show方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ProgressBarLogger
# 需要導入模塊: from qgis.PyQt.QtWidgets import QProgressBar [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QProgressBar import show [as 別名]
class ProgressBarLogger(QDialog):
"""A simple dialog with a progress bar and a label"""
def __init__(self, title = None):
QDialog.__init__(self, None)
if title is not None:
self.setWindowTitle(title)
self.__label = QLabel(self)
self.__layout = QVBoxLayout()
self.__layout.addWidget(self.__label)
self.__progress = QProgressBar(self)
self.__layout.addWidget(self.__progress)
self.setLayout(self.__layout)
self.resize(600, 70)
self.setFixedSize(600, 70)
self.__progress.hide()
self.show()
def set_text(self, t):
"""Gets called when a text is to be logged"""
if isinstance(t, tuple):
lvl, msg = t
else:
msg = t
self.__label.setText(msg)
QCoreApplication.processEvents()
def set_progress(self, i, n):
"""Gets called when there is a progression"""
self.__progress.show()
self.__progress.setMinimum(0)
self.__progress.setMaximum(n)
self.__progress.setValue(i)
QCoreApplication.processEvents()