我Pyside QProgressBar
在 MacOSX 上学习。当我像下面这样使用 QProgressBar 时,它只表示 0% 或 100%。QProgressBar如何顺利制作?有没有办法做到这一点?
from PySide.QtGui import QApplication, QProgressBar, QWidget
from PySide.QtCore import QTimer
import time
app = QApplication([])
pbar = QProgressBar()
pbar.setMinimum(0)
pbar.setMaximum(100)
pbar.show()
def drawBar():
global pbar
pbar.update()
t = QTimer()
t.timeout.connect(drawBar)
t.start(100)
for i in range(1,101):
time.sleep(0.1)
pbar.setValue(i)
app.exec_()