summaryrefslogtreecommitdiff
path: root/source/main.py
blob: 62e47b2eba661eaa7722fb4d4e34238abb7dcf68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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())