-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathback_main.py
60 lines (49 loc) · 2.01 KB
/
back_main.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
56
57
58
59
60
import sys
import os
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from PySide6.QtUiTools import *
from qt_material import apply_stylesheet
from circ_progress import ProgressCirc
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.resize(500, 500)
self.setWindowTitle('Circular Progress Bar')
self.setStyleSheet('background: transparent;')
self.setAttribute(Qt.WA_TranslucentBackground)
self.setWindowFlags(Qt.FramelessWindowHint)
self.button = QPushButton('close', self)
self.button.setGeometry(QRect(0, 0, 400, 50))
self.button.setStyleSheet('background: darkred;border: 1px solid black;')
self.button.clicked.connect(self.close)
self.container = QFrame()
self.container.setStyleSheet("background-color: transparent;")
self.layout = QVBoxLayout()
# initialize progress bar
self.progress = ProgressCirc()
self.progress.value = 60
self.progress.progress_rounded_cap = True
self.progress.add_shadow(True)
self.progress.setMinimumSize(self.progress.width, self.progress.height)
# add slider
self.slider = QSlider(Qt.Horizontal)
self.slider.setRange(0,100)
self.slider.setValue(0)
self.slider.valueChanged.connect(self.change_value)
# adding widgets to layout
self.layout.addWidget(self.progress, Qt.AlignCenter,Qt.AlignCenter)
self.layout.addWidget(self.slider, Qt.AlignCenter,Qt.AlignCenter)
self.layout.addWidget(self.button, Qt.AlignCenter,Qt.AlignCenter)
# adding layout to container and center container
self.container.setLayout(self.layout)
self.setCentralWidget(self.container)
self.show()
def change_value(self, value):
self.progress.setValue(value)
if __name__ == "__main__":
app = QApplication(sys.argv)
main = MainWindow()
main.show()
sys.exit(app.exec())