diff --git a/main2 b/main2 index 7b26c53..dad8939 100644 --- a/main2 +++ b/main2 @@ -15,13 +15,13 @@ import pyqtgraph as pg #import matplotlib.pyplot as plt #import sys -colors = {} +colors = {} #переменная для работы с цветом, позже нам понадобится last_clicked_label = None plotLen = 20 valArr = [20] * plotLen plot = None -def led1 (checked): +def led1 (checked): #отвечает за включение первого светодиода if checked: form.pushButton_2.setText("Выкл") print("I'm worked too much") @@ -33,7 +33,7 @@ def led1 (checked): form.pushButton_2.setText("Вкл") print ("I'm worked too") -def led2 (checked): +def led2 (checked): #отвечает за включение второго светодиода if checked: form.pushButton_3.setText("Выкл") print("I'm worked too much") @@ -45,7 +45,7 @@ def led2 (checked): form.pushButton_3.setText("Вкл") print ("I'm worked too") -def led3 (checked): +def led3 (checked): #отвечает за включение третьего светодиода if checked: form.pushButton_4.setText("Выкл") print("I'm worked too much") @@ -60,14 +60,14 @@ def led3 (checked): print ("I'm worked too") -def updateLCD(): - global temp +def updateLCD(): #обновление дисплея + global temp #переменная для работы с дисплеем form.lcdNumber.display(temp) -def sed (): +def sed (): #проверка работы элемента print ("I'm worked!") -led_data = { +led_data = { #список начальных параметров у светодиода "leds1": {"red": 0, "green": 0, "blue": 0}, "leds2": {"red": 0, "green": 0, "blue": 0}, "leds3": {"red": 0, "green": 0, "blue": 0}, @@ -80,7 +80,7 @@ led_data = { def vkl(): for led in form.leds: - #caution! Naming will be the same for a Led and JSON led objects + #осторожно! Одинаковые названия у объектов Led и JSON. led.setStyleSheet(f"background-color: yellow;") led_data[led.objectName()]["red"] = 255 led_data[led.objectName()]["green"] = 255 @@ -88,15 +88,15 @@ def vkl(): def vikl(): for led in form.leds: - #caution! Naming will be the same for a Led and JSON led objects + #осторожно! Одинаковые названия у объектов Led и JSON. led.setStyleSheet(f"background-color: black;") led_data[led.objectName()]["red"] = 0 led_data[led.objectName()]["green"] = 0 led_data[led.objectName()]["blue"] = 0 def color(): - color = QColorDialog.getColor() - if color.isValid(): + color = QColorDialog.getColor() #получение цвета от диалога + if color.isValid(): #проверка наличия цвета и применение его над изображением программы palette = QPalette() palette.setColor(QPalette.Button, color) form.color_b.setPalette(palette)