um24clab/src/um24clab.py

50 lines
1.2 KiB
Python
Raw Normal View History

2020-01-19 13:31:33 +01:00
#!/usr/bin/env python
import sys
2020-01-21 14:19:14 +01:00
from PySide2.QtWidgets import (
QApplication, QMainWindow
2020-01-19 13:31:33 +01:00
)
2020-01-21 14:19:14 +01:00
from PySide2.QtCharts import (
QtCharts
)
from UM24CUI import Ui_MainWindow
import random
2020-01-19 13:31:33 +01:00
class UM24Lab(QMainWindow):
2020-01-21 14:19:14 +01:00
def __init__(self):
super(UM24Lab, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
2020-01-19 13:31:33 +01:00
2020-01-21 14:19:14 +01:00
self.ui.plotVoltage = QtCharts.QChart()
self.ui.widgetVoltage.setChart(self.ui.plotVoltage)
2020-01-19 17:08:43 +01:00
2020-01-21 14:19:14 +01:00
self.ui.plotCurrent = QtCharts.QChart()
self.ui.widgetCurrent.setChart(self.ui.plotCurrent)
2020-01-19 13:31:33 +01:00
2020-01-21 14:19:14 +01:00
voltage = self.ui.plotVoltage
series = QtCharts.QLineSeries()
series.setName('Voltage')
for x in range(100):
y = random.randint(0, 10)
series.append(x, y)
voltage.addSeries(series)
2020-01-19 13:31:33 +01:00
2020-01-21 14:19:14 +01:00
current = self.ui.plotCurrent
series = QtCharts.QLineSeries()
series.setName('Current')
for x in range(100):
y = random.randint(0, 10)
series.append(x, y)
current.addSeries(series)
2020-01-19 13:31:33 +01:00
if __name__ == '__main__':
app = QApplication(sys.argv)
2020-01-21 14:19:14 +01:00
labview = UM24Lab()
labview.show()
2020-01-19 13:31:33 +01:00
sys.exit(app.exec_())