本章,精选了几个好看的可用于实际项目中的进度条样式。先来看看几个图:

这些都是纯代码编写,本章没有废话,有的全是代码。
示例1-双半边进度条
import sys
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QPainter, QColor, QPen, QLinearGradient, QFont
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout
class CircularProgressBar(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
self.setMinimumSize(200, 200)
self.setMaximumSize(200, 200)
self.timer = QTimer(self)
self.timer.timeout.connect(self.updateValue)
self.timer.start(50) # 每50毫秒更新一次进度
self.value = 0
def updateValue(self):
self.value += 1
if