|
13 | 13 | import sys |
14 | 14 | from PyQt5.QtCore import QCoreApplication, Qt |
15 | 15 | from PyQt5.QtGui import QIcon |
16 | | -from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QAction, QMessageBox |
| 16 | +from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, \ |
| 17 | + QAction, QMessageBox |
17 | 18 | from PyQt5.QtWidgets import QCheckBox, QProgressBar |
18 | 19 |
|
| 20 | + |
19 | 21 | class window(QMainWindow): |
20 | 22 |
|
21 | 23 | def __init__(self): |
@@ -61,30 +63,27 @@ def home(self): |
61 | 63 | self.btn.move(200, 120) |
62 | 64 | self.btn.clicked.connect(self.download) |
63 | 65 |
|
64 | | - |
65 | 66 | self.show() |
66 | 67 |
|
67 | 68 | def download(self): |
68 | 69 | self.completed = 0 |
69 | 70 |
|
70 | 71 | while self.completed < 100: |
71 | | - self.completed += 0.0001 |
| 72 | + self.completed += 0.00005 |
72 | 73 | self.progress.setValue(self.completed) |
73 | | - |
74 | | - |
| 74 | + QApplication.processEvents() # from stackoverflow |
75 | 75 |
|
76 | 76 | def enlarge_window(self, state): |
77 | 77 | if state == Qt.Checked: |
78 | 78 | self.setGeometry(50, 50, 1000, 600) |
79 | 79 | else: |
80 | | - self.setGeometry(50, 50 , 500, 300) |
81 | | - |
| 80 | + self.setGeometry(50, 50, 500, 300) |
82 | 81 |
|
83 | 82 | def close_application(self): |
84 | 83 |
|
85 | 84 | choice = QMessageBox.question(self, 'Message', |
86 | | - "Are you sure to quit?", QMessageBox.Yes | |
87 | | - QMessageBox.No, QMessageBox.No) |
| 85 | + "Are you sure to quit?", QMessageBox.Yes | |
| 86 | + QMessageBox.No, QMessageBox.No) |
88 | 87 |
|
89 | 88 | if choice == QMessageBox.Yes: |
90 | 89 | print('quit application') |
|
0 commit comments