圆形水位进度条
This commit is contained in:
parent
bda63d85a9
commit
1fa64ba8f2
4 changed files with 60 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
- [百分比进度条](#3百分比进度条)
|
||||
- [Metro进度条](#4Metro进度条)
|
||||
- [水波纹进度条](#5水波纹进度条)
|
||||
- [圆形水位进度条](#6圆形水位进度条)
|
||||
|
||||
## 1、常规样式美化
|
||||
[运行 SimpleStyle.py](SimpleStyle.py)
|
||||
|
@ -36,4 +37,11 @@
|
|||
2. 利用 `QPainterPath` 矩形或者圆形作为背景
|
||||
3. 用 `QPainterPath` 把y坐标用 `lineTo` 连接起来形成一个U字形+上方波浪的闭合区间
|
||||
|
||||
![WaterProgressBar](ScreenShot/WaterProgressBar.gif)
|
||||
![WaterProgressBar](ScreenShot/WaterProgressBar.gif)
|
||||
|
||||
## 6、圆形水位进度条
|
||||
[运行 WaterProgress.py](WaterProgress.py)
|
||||
|
||||
参考 https://github.com/linuxdeepin/dtkwidget/blob/master/src/widgets/dwaterprogress.cpp
|
||||
|
||||
![WaterProgressBar](ScreenShot/WaterProgress.gif)
|
||||
|
|
BIN
QProgressBar/ScreenShot/WaterProgress.gif
Normal file
BIN
QProgressBar/ScreenShot/WaterProgress.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 173 KiB |
50
QProgressBar/WaterProgress.py
Normal file
50
QProgressBar/WaterProgress.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Created on 2021/1/1
|
||||
@author: Irony
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: WaterProgress
|
||||
@description:
|
||||
"""
|
||||
import sys
|
||||
|
||||
from Lib.DWaterProgress import DWaterProgress
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
|
||||
|
||||
|
||||
class WaterProgressWindow(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(WaterProgressWindow, self).__init__(*args, **kwargs)
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
self.progress = DWaterProgress(self)
|
||||
self.progress.setFixedSize(100, 100)
|
||||
self.progress.setValue(0)
|
||||
self.progress.start()
|
||||
|
||||
layout.addWidget(self.progress)
|
||||
|
||||
self.timer = QTimer(self, timeout=self.updateProgress)
|
||||
self.timer.start(50)
|
||||
|
||||
def updateProgress(self):
|
||||
value = self.progress.value()
|
||||
if value == 100:
|
||||
self.progress.setValue(0)
|
||||
else:
|
||||
self.progress.setValue(value + 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import cgitb
|
||||
|
||||
cgitb.enable(format='text')
|
||||
app = QApplication(sys.argv)
|
||||
w = WaterProgressWindow()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
|
@ -123,6 +123,7 @@ https://pyqt.site 论坛是专门针对PyQt5学习和提升开设的网站,分
|
|||
- [百分比进度条](QProgressBar/PercentProgressBar.py)
|
||||
- [Metro进度条](QProgressBar/MetroCircleProgress.py)
|
||||
- [水波纹进度条](QProgressBar/WaterProgressBar.py)
|
||||
- [圆形水位进度条](QProgressBar/WaterProgress.py)
|
||||
- [QSplashScreen](QSplashScreen)
|
||||
- [启动画面动画](QSplashScreen/GifSplashScreen.py)
|
||||
- [QOpenGLWidget](QOpenGLWidget)
|
||||
|
|
Loading…
Reference in a new issue