forked from PyQt5/PyQt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaterProgress.py
55 lines (42 loc) · 1.31 KB
/
WaterProgress.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2021/1/1
@author: Irony
@site: https://pyqt.site , https://github.com/PyQt5
@email: [email protected]
@file: WaterProgress
@description:
"""
import sys
try:
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
except ImportError:
from PySide2.QtCore import QTimer
from PySide2.QtWidgets import QApplication, QWidget, QVBoxLayout
from Lib.DWaterProgress import DWaterProgress
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_())