add test widget
This commit is contained in:
parent
3a0a113448
commit
083f16dd9b
3 changed files with 19 additions and 39 deletions
|
@ -88,7 +88,6 @@ encoding//\u754C\u9762\u7F8E\u5316/QScrollBar\u6EDA\u52A8\u6761\u6837\u5F0F/Scro
|
|||
encoding//\u754C\u9762\u7F8E\u5316/QSlider\u7F8E\u5316/PaintQSlider.py=utf-8
|
||||
encoding//\u754C\u9762\u7F8E\u5316/QSlider\u7F8E\u5316/QssQSlider.py=utf-8
|
||||
encoding//\u754C\u9762\u7F8E\u5316/\u5404\u7C7B\u8FDB\u5EA6\u6761/CircleProgressBar.py=utf-8
|
||||
encoding//\u754C\u9762\u7F8E\u5316/\u5404\u7C7B\u8FDB\u5EA6\u6761/Test.py=utf-8
|
||||
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/ProgressBar.py=utf-8
|
||||
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/TestWidget.py=utf-8
|
||||
encoding//\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
|
||||
|
|
|
@ -11,7 +11,7 @@ Created on 2018年9月4日
|
|||
"""
|
||||
from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt
|
||||
from PyQt5.QtGui import QColor, QPainter
|
||||
from PyQt5.QtWidgets import QWidget
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
|
@ -27,9 +27,12 @@ class CircleProgressBar(QWidget):
|
|||
Clockwise = True # 顺时针还是逆时针
|
||||
Delta = 36
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
def __init__(self, *args, color=None, clockwise=True, **kwargs):
|
||||
super(CircleProgressBar, self).__init__(*args, **kwargs)
|
||||
self.angle = 0
|
||||
self.Clockwise = clockwise
|
||||
if color:
|
||||
self.Color = color
|
||||
self._timer = QTimer(self, timeout=self.update)
|
||||
self._timer.start(100)
|
||||
|
||||
|
@ -87,10 +90,23 @@ class CircleProgressBar(QWidget):
|
|||
return QSize(100, 100)
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Window, self).__init__(*args, **kwargs)
|
||||
layout = QHBoxLayout(self)
|
||||
layout.addWidget(CircleProgressBar(self))
|
||||
layout.addWidget(CircleProgressBar(
|
||||
self, color=QColor(255, 0, 0), clockwise=False))
|
||||
layout.addWidget(CircleProgressBar(self, styleSheet="""
|
||||
qproperty-color: rgb(0, 255, 0);
|
||||
"""))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
app = QApplication(sys.argv)
|
||||
w = CircleProgressBar()
|
||||
w = Window()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Created on 2018年9月4日
|
||||
@author: Irony
|
||||
@site: https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: Test
|
||||
@description:
|
||||
"""
|
||||
from PyQt5.QtWidgets import QWidget, QFormLayout
|
||||
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|
||||
Email: 892768447@qq.com"""
|
||||
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Window, self).__init__(*args, **kwargs)
|
||||
layout = QFormLayout(self)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
Loading…
Reference in a new issue