um24clab/src/um24clab.py

50 lines
1.2 KiB
Python

#!/usr/bin/env python
import sys
from PySide2.QtWidgets import (
QApplication, QMainWindow
)
from PySide2.QtCharts import (
QtCharts
)
from UM24CUI import Ui_MainWindow
import random
class UM24Lab(QMainWindow):
def __init__(self):
super(UM24Lab, self).__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.plotVoltage = QtCharts.QChart()
self.ui.widgetVoltage.setChart(self.ui.plotVoltage)
self.ui.plotCurrent = QtCharts.QChart()
self.ui.widgetCurrent.setChart(self.ui.plotCurrent)
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)
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)
if __name__ == '__main__':
app = QApplication(sys.argv)
labview = UM24Lab()
labview.show()
sys.exit(app.exec_())