(self)
| 57 | self.timer.start() |
| 58 | |
| 59 | def handleTimeout(self): |
| 60 | x = self.plotArea().width() / self.axisX.tickCount() |
| 61 | y = (self.axisX.max() - self.axisX.min()) / self.axisX.tickCount() |
| 62 | self.m_x += y |
| 63 | # 在PyQt5.11.3及以上版本中,QRandomGenerator.global()被重命名为global_() |
| 64 | self.m_y = QRandomGenerator.global_().bounded(5) - 2.5 |
| 65 | self.series.append(self.m_x, self.m_y) |
| 66 | self.scroll(x, 0) |
| 67 | if self.m_x >= 100: |
| 68 | self.timer.stop() |
| 69 | |
| 70 | |
| 71 | if __name__ == "__main__": |