PyQt progress bar
发布时间:2020-05-24 23:12:56 所属栏目:Python 来源:互联网
导读:PyQt progress bar
|
下面是脚本之家 jb51.cc 通过网络收集整理的代码片段。 脚本之家小编现在分享给大家,也给大家做个参考。 #!/usr/bin/env python
# --*--codig: utf8 --*--
from PyQt4 import QtGui
from PyQt4 import QtCore
class BaseProgressBar(QtGui.QWidget):
updateProgress = QtCore.pyqtSignal(str)
def __init__(self,text='',parent=None):
super(BaseProgressBar,self).__init__(parent)
self.setFixedHeight(50)
self.text = text
self.progressbar = QtGui.QProgressBar( )
self.progressbar.setTextVisible(True)
self.updateProgress.connect(self.setValue)
self.bottomBorder = QtGui.QWidget( )
self.bottomBorder.setStyleSheet("""
background: palette(shadow);
""")
self.bottomBorder.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.QSizePolicy.Fixed))
self.bottomBorder.setMinimumHeight(1)
self.label = QtGui.QLabel(self.text)
self.label.setStyleSheet("""
font-weight: bold;
""")
self.layout = QtGui.QVBoxLayout( )
self.layout.setContentsMargins(10,10,0)
self.layout.addWidget(self.label)
self.layout.addWidget(self.progressbar)
self.mainLayout = QtGui.QVBoxLayout( )
self.mainLayout.setContentsMargins(0,0)
self.mainLayout.addLayout(self.layout)
self.mainLayout.addWidget(self.bottomBorder)
self.setLayout(self.mainLayout)
self.totalValue = 0
def setValue(self,value):
self.totalValue += len(value)
self.progressbar.setValue(self.totalValue)
def setMax(self,value):
self.progressbar.setMaximum(value)
以上是脚本之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。 如果觉得脚本之家网站内容还不错,欢迎将脚本之家网站推荐给程序员好友。 (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
