Exemplo n.º 1
0
    def rgb_changed(self, *args):
        if self.changing:
            return

        r, g, b = self.spin_r.value(), self.spin_g.value(), self.spin_b.value()
        rgb = QColor(r, g, b)
        h, s, l = rgb.hue(), rgb.saturation(), rgb.lightness()

        self.changing = True
        self.spin_h.setValue(h)
        self.spin_s.setValue(s)
        self.spin_l.setValue(l)
        self.changing = False

        self.rgb_led.set_rgb_value(r, g, b)
        self.label_color.setStyleSheet('QLabel {{ background: #{:02x}{:02x}{:02x} }}'.format(r, g, b))
Exemplo n.º 2
0
    def rgb_changed(self, *args):
        if self.changing:
            return

        r, g, b = self.spin_r.value(), self.spin_g.value(), self.spin_b.value()
        rgb = QColor(r, g, b)
        h, s, l = rgb.hue(), rgb.saturation(), rgb.lightness()

        self.changing = True
        self.spin_h.setValue(h)
        self.spin_s.setValue(s)
        self.spin_l.setValue(l)
        self.changing = False

        self.rgb_led_button.set_color(r, g, b)
        self.label_color.setStyleSheet(
            'QLabel {{ background: #{:02x}{:02x}{:02x} }}'.format(r, g, b))