Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtCore import QTimer
- from PyQt5.QtWidgets import QLabel
- from PyQt5.QtCore import pyqtSlot
- class QBlinkLabel(QLabel):
- """Мигающий QLabel"""
- def __init__(self, parent):
- super(QBlinkLabel, self).__init__()
- self.status = True
- self.blink_color_one = None
- self.blink_color_two = None
- def startBlink(self, color_one, color_two):
- self.blink_color_one = "background-color: {};".format(color_one)
- self.blink_color_two = "background-color: {};".format(color_two)
- def stopBlink(self, color_one):
- self.blink_color_two = None
- self.setStyleSheet("background-color: {};".format(color_one))
- def setColor(self, color):
- self.setStyleSheet("background-color: {};".format(color))
- @pyqtSlot()
- def update_color(self):
- if self.blink_color_two is not None:
- if self.status:
- self.setStyleSheet(self.blink_color_one)
- else:
- self.setStyleSheet(self.blink_color_two)
- self.status = not self.status
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement