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 | |
| parent | fdd3b103bb209045123693cd60149b951c7b2be8 (diff) | |
made the first form of a practicle gui
Diffstat (limited to 'source')
| -rw-r--r-- | source/.DS_Store | bin | 0 -> 6148 bytes | |||
| -rw-r--r-- | source/__pycache__/hardware_driver.cpython-313.pyc | bin | 0 -> 12187 bytes | |||
| -rw-r--r-- | source/main.py | 41 |
3 files changed, 41 insertions, 0 deletions
diff --git a/source/.DS_Store b/source/.DS_Store new file mode 100644 index 0000000..2b35964 --- /dev/null +++ b/source/.DS_Store | |||
| Binary files differ | |||
diff --git a/source/__pycache__/hardware_driver.cpython-313.pyc b/source/__pycache__/hardware_driver.cpython-313.pyc new file mode 100644 index 0000000..d6c84ad --- /dev/null +++ b/source/__pycache__/hardware_driver.cpython-313.pyc | |||
| Binary files differ | |||
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 @@ | |||
| 1 | from PySide6.QtWidgets import QApplication, QLabel, QMainWindow, QPushButton, QLabel, QVBoxLayout, QWidget | ||
| 2 | from PySide6.QtCore import Qt | ||
| 3 | from hardware_driver import lcd | ||
| 4 | import sys | ||
| 5 | |||
| 6 | |||
| 7 | L = lcd() | ||
| 8 | |||
| 9 | class mainWindow(QMainWindow): | ||
| 10 | def __init__(self): | ||
| 11 | super().__init__() | ||
| 12 | self.setWindowTitle("I2C CONTROLLER") | ||
| 13 | self.setGeometry(200,100,800,300) | ||
| 14 | self.mainUI() | ||
| 15 | |||
| 16 | def mainUI(self): | ||
| 17 | central_widget = QWidget(self) | ||
| 18 | self.setCentralWidget(central_Widget) | ||
| 19 | |||
| 20 | self.label = QLabel("CONNECTED TO I2C DEVICE", self) | ||
| 21 | self.label.setAlignment(Qt.AlignCenter) | ||
| 22 | |||
| 23 | self.button = QPushButton("Clear Screen", self) | ||
| 24 | self.button.clicked.connect(self.clear_screen) | ||
| 25 | |||
| 26 | layout = QVBoxLayout() | ||
| 27 | layout.addWidget(self.label) | ||
| 28 | layout.addWidget(self.button) | ||
| 29 | |||
| 30 | central_widget.setLayout(layout) | ||
| 31 | |||
| 32 | def clear_screen(): | ||
| 33 | lcd.clear() | ||
| 34 | self.label.setText("Cleared the LCD screen", self) | ||
| 35 | |||
| 36 | if __name__ == "__main__": | ||
| 37 | app = QApplication(sys.argv) | ||
| 38 | window = mainWindow() | ||
| 39 | window.show() | ||
| 40 | sys.exit(app.exec()) | ||
| 41 | |||
