diff options
Diffstat (limited to 'source/main_qt.py')
| -rw-r--r-- | source/main_qt.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/source/main_qt.py b/source/main_qt.py new file mode 100644 index 0000000..5a37a88 --- /dev/null +++ b/source/main_qt.py | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | from PySide6.QtWidgets import ( | ||
| 2 | QApplication, | ||
| 3 | QLabel, | ||
| 4 | QMainWindow, | ||
| 5 | QPushButton, | ||
| 6 | QVBoxLayout, | ||
| 7 | QWidget, | ||
| 8 | ) | ||
| 9 | from PySide6.QtCore import Qt | ||
| 10 | import hardware_driver as lcd | ||
| 11 | import features as fe | ||
| 12 | import sys | ||
| 13 | |||
| 14 | F = fe.feat() | ||
| 15 | L = lcd.LCD() | ||
| 16 | |||
| 17 | |||
| 18 | class mainWindow(QMainWindow): | ||
| 19 | def __init__(self): | ||
| 20 | super().__init__() | ||
| 21 | self.setWindowTitle("I2C CONTROLLER") | ||
| 22 | self.setGeometry(200, 100, 800, 300) | ||
| 23 | self.mainUI() | ||
| 24 | |||
| 25 | def mainUI(self): | ||
| 26 | central_widget = QWidget(self) | ||
| 27 | self.setCentralWidget(central_widget) | ||
| 28 | |||
| 29 | self.label = QLabel("CONNECTED TO I2C DEVICE", self) | ||
| 30 | self.label.setAlignment(Qt.AlignCenter) | ||
| 31 | |||
| 32 | self.button = QPushButton("Clear Screen", self) | ||
| 33 | self.button.clicked.connect(self.clear_screen) | ||
| 34 | |||
| 35 | layout = QVBoxLayout() | ||
| 36 | layout.addWidget(self.label) | ||
| 37 | layout.addWidget(self.button) | ||
| 38 | |||
| 39 | central_widget.setLayout(layout) | ||
| 40 | |||
| 41 | def clear_screen(self): | ||
| 42 | F.clear() | ||
| 43 | self.label.setText("Cleared the LCD screen") | ||
| 44 | |||
| 45 | |||
| 46 | if __name__ == "__main__": | ||
| 47 | app = QApplication(sys.argv) | ||
| 48 | window = mainWindow() | ||
| 49 | window.show() | ||
| 50 | sys.exit(app.exec()) | ||
