Python PyQt5.QtGui.QPalette.Background() Examples

The following are 8 code examples of PyQt5.QtGui.QPalette.Background(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtGui.QPalette , or try the search function .
Example #1
Source File: captivox.py    From captivox with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        super().__init__()
        pal = QPalette()
        pal.setColor(QPalette.Background, QColor("#fff"))
        self.setPalette(pal)
        self.setAutoFillBackground(True)
        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        self.frame_no = 1
        self.angle_factor = ANGLE_FACTOR_DEF  # related to degrees offset of each dot
        self.num_dots = NUM_DOTS_DEF
        self.dot_size = DOT_SIZE_DEF
        self.x_multiplier = X_MULT_DEF
        self.y_multiplier = Y_MULT_DEF
        self.halfmax = HALFMAX_DEF
        self.speedmult = SPEED_MULT_DEF
        self.draw_axes = AXES_DEF
        self.join_end_dots = JOIN_ENDS_DEF
        self.col1 = COL1_DEF
        self.col2 = COL2_DEF
        self.draw_lines = LINES_DEF
        self.connect_lines = CONNECT_LINES_DEF 
Example #2
Source File: interruptorPalanca.py    From PyQt5 with MIT License 6 votes vote down vote up
def actualizarEstado(self):
        # Si la posicion x del boton mas la mitad de su ancho
        # es menor que la mitad del ancho del widget padre,
        # entonces esta apagado (NO)
        if (self.parent.button.x() + (self.parent.button.width() / 2)) < Frame.VALOR / 2:
            self.habilitado = False
            
        # Si la posicion x del boton mas la mitad de su ancho
        # es mayor que la mitad del ancho del widget padre,
        # entonces esta encendido (SI)
        if (self.parent.button.x() + (self.parent.button.width() / 2)) > Frame.VALOR / 2:
            self.habilitado = True
            
        if self.habilitado:
            self.parent.button.setText("SI")
            color = QColor(206, 61, 59)
        elif not self.habilitado:
            self.parent.button.setText("NO")
            color = QColor(147, 183, 89)

        colorFrame = self.palette()
        colorFrame.setColor(QPalette.Background, color)
        self.setPalette(colorFrame) 
Example #3
Source File: interruptorPalanca.py    From PyQt5 with MIT License 6 votes vote down vote up
def actualizarEstado(self):
        # Si la posicion x del boton mas la mitad de su ancho
        # es menor que la mitad del ancho del widget padre,
        # entonces esta apagado (NO)
        if (self.x() + (self.width() / 2)) < PushButton.VALOR / 2:
            self.habilitado = False
            
        # Si la posicion x del boton mas la mitad de su ancho
        # es mayor que la mitad del ancho del widget padre,
        # entonces esta encendido (SI)
        if (self.x() + (self.width() / 2)) > PushButton.VALOR / 2:
            self.habilitado = True
            
        if self.habilitado:
            self.setText("SI")
            color = QColor(206, 61, 59)
        elif not self.habilitado:
            self.setText("NO")
            color = QColor(147, 183, 89)

        colorFrame = self.palette()
        colorFrame.setColor(QPalette.Background, color)
        self.parent.setPalette(colorFrame) 
Example #4
Source File: battleView.py    From imperialism-remake with GNU General Public License v3.0 5 votes vote down vote up
def setup_ui(self):
        self.battleWindow.setWindowTitle(self.battleWindow.config.get_text('battle.window.title') + ' v' + str(self.battleWindow.config.version))
        background = self.battleWindow.config.theme_selected.get_background_pixmap()
        palette = QPalette()
        palette.setBrush(QPalette.Background, QBrush(background))
        self.battleWindow.setMinimumSize(constants.get_min_resolution_qsize())
        self.battleWindow.setAutoFillBackground(True)
        self.gridLayout.setVerticalSpacing(0)

        self.setup_hint_label()  # Labels
        self.setup_turn_label()  # Labels
        self.setup_space()  # Space item

        self.setup_help_button()  # Help Push Button
        self.setup_next_target_button()  # Next Target Button
        self.setup_end_unit_button()  # End Unit Button
        self.setup_retreat_button()  # Retreat Button
        self.setup_auto_combat_button()  # Automatic battle button

        self.setup_targeted_unit_view()  # Targeted Unit view
        self.setup_current_unit_view()  # Current Unit View
        self.setup_coat_of_arms_view()  # Coat of Arm view

        self.setup_map()  # Main view
        self.battleWindow.setPalette(palette)
        self.battleWindow.setCentralWidget(self.centralWidget)

        # noinspection PyArgumentList
        QMetaObject.connectSlotsByName(self.battleWindow) 
Example #5
Source File: status_display.py    From stytra with GNU General Public License v3.0 5 votes vote down vote up
def addMessage(self, message, persist=3):

        end_color = _hex_to_rgb(self.palette().color(QPalette.Background).name())

        if not message or len(message) < 2:
            return
        if message in self.current_messages.keys():
            self.current_messages[message].refresh()

        else:
            self.current_messages[message] = DisplayedMessage(
                message, persist=persist, end_color=end_color
            )
            self.new_messages.append(self.current_messages[message]) 
Example #6
Source File: multiscope.py    From stytra with GNU General Public License v3.0 5 votes vote down vote up
def _qcolorstring(self, color):
        colorname = self.palette().color(QPalette.Background).name().lstrip("#")
        return "rgb({},{},{})".format(
            *(int(colorname[i * 2 : i * 2 + 2], 16) for i in range(3))
        ) 
Example #7
Source File: siacle.py    From PyQt5 with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(Configuracion, self).__init__(parent)
        
        self.setWindowFlags(Qt.Popup)
        self.setFixedSize(450, 500)

        paleta = self.palette()
        paleta.setColor(QPalette.Background, QColor("white"))
        self.setPalette(paleta)

        self.initUI() 
Example #8
Source File: login.py    From PyQt5 with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(ventanaLogin, self).__init__(parent)
        
        self.setWindowTitle("Login con PyQt5 por: ANDRES NIÑO")
        self.setWindowIcon(QIcon("icono.png"))
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.MSWindowsFixedSizeDialogHint)
        self.setFixedSize(400, 380)

        paleta = QPalette()
        paleta.setColor(QPalette.Background, QColor(243, 243, 243))
        self.setPalette(paleta)

        self.initUI()