summaryrefslogtreecommitdiff
path: root/source/main.py
blob: 5a37a882d0eba13fe03d35fe4fafa5617628761e (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
42
43
44
45
46
47
48
49
50
from PySide6.QtWidgets import (
    QApplication,
    QLabel,
    QMainWindow,
    QPushButton,
    QVBoxLayout,
    QWidget,
)
from PySide6.QtCore import Qt
import hardware_driver as lcd
import features as fe
import sys

F = fe.feat()  
L = lcd.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(self):  
        F.clear()  
        self.label.setText("Cleared the LCD screen")  


if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = mainWindow()
    window.show()
    sys.exit(app.exec())