(self, *args, **kwargs)
| 46 | class Window(QWidget): |
| 47 | |
| 48 | def __init__(self, *args, **kwargs): |
| 49 | super(Window, self).__init__(*args, **kwargs) |
| 50 | layout = QVBoxLayout(self) |
| 51 | self.progressBar = QProgressBar(self) |
| 52 | layout.addWidget(self.progressBar) |
| 53 | layout.addWidget(QPushButton('休眠', self, clicked=self.doWait)) |
| 54 | layout.addWidget(QPushButton('唤醒', self, clicked=self.doWake)) |
| 55 | |
| 56 | self.t = Thread(self) |
| 57 | self.t.valueChange.connect(self.progressBar.setValue) |
| 58 | self.t.start() |
| 59 | |
| 60 | def doWait(self): |
| 61 | self.t.pause() |