diff options
| author | Abdellah El Morabit <nsrddyn@gmail.com> | 2024-11-29 23:54:15 +0100 |
|---|---|---|
| committer | Abdellah El Morabit <nsrddyn@gmail.com> | 2024-11-29 23:54:15 +0100 |
| commit | 35b476a90b585186161ab91ef9b73d029a2ee834 (patch) | |
| tree | 8306c308aa921de6881123a083002249976a7dcd /source/main.py | |
| parent | fdd3b103bb209045123693cd60149b951c7b2be8 (diff) | |
made the first form of a practicle gui
Diffstat (limited to 'source/main.py')
| -rw-r--r-- | source/main.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/main.py b/source/main.py new file mode 100644 index 0000000..62e47b2 --- /dev/null +++ b/source/main.py @@ -0,0 +1,41 @@ +from PySide6.QtWidgets import QApplication, QLabel, QMainWindow, QPushButton, QLabel, QVBoxLayout, QWidget +from PySide6.QtCore import Qt +from hardware_driver import lcd +import sys + + +L = lcd() + +class mainWindow(QMainWindow): + def __init__(self): + super().__init__() + self.setWindowTitle("I2C CONTROLLER") + self.setGeometry(200,100,800,300) + self.mainUI() + + def mainUI(self): + central_widget = QWidget(self) + self.setCentralWidget(central_Widget) + + self.label = QLabel("CONNECTED TO I2C DEVICE", self) + self.label.setAlignment(Qt.AlignCenter) + + self.button = QPushButton("Clear Screen", self) + self.button.clicked.connect(self.clear_screen) + + layout = QVBoxLayout() + layout.addWidget(self.label) + layout.addWidget(self.button) + + central_widget.setLayout(layout) + + def clear_screen(): + lcd.clear() + self.label.setText("Cleared the LCD screen", self) + +if __name__ == "__main__": + app = QApplication(sys.argv) + window = mainWindow() + window.show() + sys.exit(app.exec()) + |
