本文整理汇总了Python中PyQt5.QtGui.QPalette.Background方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.Background方法的具体用法?Python QPalette.Background怎么用?Python QPalette.Background使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QPalette
的用法示例。
在下文中一共展示了QPalette.Background方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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
示例2: actualizarEstado
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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)
示例3: setup_ui
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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)
示例4: addMessage
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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])
示例5: _qcolorstring
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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))
)
示例6: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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()
示例7: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import Background [as 别名]
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()