Изменил(а) на 'main2'

This commit is contained in:
vova 2023-04-10 21:35:38 +03:00
parent 7b71cdd0c5
commit 03d59cc155

24
main2
View File

@ -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)