From 03d59cc155d416858f2eab0240b3c51d26541d28 Mon Sep 17 00:00:00 2001 From: vova Date: Mon, 10 Apr 2023 21:35:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'main2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main2 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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)