当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QPalette方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QPalette方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPalette方法的具体用法?Python QtGui.QPalette怎么用?Python QtGui.QPalette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui的用法示例。


在下文中一共展示了QtGui.QPalette方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.leftMargin = 30
        self.chartWidth = 250
        self.chartHeight = 250
        self.minDisplayValue = -80
        self.maxDisplayValue = 10

        self.minValue = 0
        self.maxValue = 1
        self.span = 1

        self.isInverted = False

        self.setMinimumSize(self.chartWidth + self.rightMargin + self.leftMargin,
                            self.chartHeight + self.topMargin + self.bottomMargin)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:24,代码来源:LogMag.py

示例2: SetAppStyle

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def SetAppStyle(styleKey=''):
    """
    Set the application window color
    """
    # Change the color if applicable
    if globals.theme.color('ui') is not None and not globals.theme.forceStyleSheet:
        globals.app.setPalette(QtGui.QPalette(globals.theme.color('ui')))

    # Change the style
    if not styleKey: styleKey = setting('uiStyle', "Fusion")
    style = QtWidgets.QStyleFactory.create(styleKey)
    globals.app.setStyle(style)

    # Apply the style sheet, if exists
    if globals.theme.styleSheet:
        globals.app.setStyleSheet(globals.theme.styleSheet)

    # Manually set the background color
    if globals.theme.forceUiColor and not globals.theme.forceStyleSheet:
        color = globals.theme.color('ui').getRgb()
        bgColor = "#%02x%02x%02x" % tuple(map(lambda x: x // 2, color[:3]))
        globals.app.setStyleSheet("""
            QListView, QTreeWidget, QLineEdit, QDoubleSpinBox, QSpinBox, QTextEdit{
                background-color: %s;
            }""" % bgColor) 
开发者ID:aboood40091,项目名称:Miyamoto,代码行数:27,代码来源:ui.py

示例3: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.leftMargin = 30
        self.chartWidth = 250
        self.chartHeight = 250
        self.minDisplayValue = 0
        self.maxDisplayValue = 100

        self.minValue = -1
        self.maxValue = 1
        self.span = 1

        self.setMinimumSize(self.chartWidth + self.rightMargin + self.leftMargin,
                            self.chartHeight + self.topMargin + self.bottomMargin)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:22,代码来源:Capacitance.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.leftMargin = 35
        self.chartWidth = 250
        self.chartHeight = 250
        self.fstart = 0
        self.fstop = 0
        self.minQ = 0
        self.maxQ = 0
        self.span = 0
        self.minDisplayValue = 0
        self.maxDisplayValue = 100

        self.setMinimumSize(self.chartWidth + self.rightMargin + self.leftMargin,
                            self.chartHeight + self.topMargin + self.bottomMargin)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:23,代码来源:QFactor.py

示例5: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.leftMargin = 30
        self.chartWidth = 250
        self.chartHeight = 250
        self.minDisplayValue = 0
        self.maxDisplayValue = 100

        self.minValue = 0
        self.maxValue = 1
        self.span = 1

        self.setMinimumSize(self.chartWidth + self.rightMargin + self.leftMargin,
                            self.chartHeight + self.topMargin + self.bottomMargin)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:22,代码来源:MagnitudeZ.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.leftMargin = 30
        self.chartWidth = 250
        self.chartHeight = 250
        self.minDisplayValue = 0
        self.maxDisplayValue = 1

        self.fixedValues = True
        self.y_action_fixed_span.setChecked(True)
        self.y_action_automatic.setChecked(False)

        self.minValue = 0
        self.maxValue = 1
        self.span = 1

        self.setMinimumSize(self.chartWidth + self.rightMargin + self.leftMargin,
                            self.chartHeight + self.topMargin + self.bottomMargin)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:26,代码来源:Magnitude.py

示例7: dark

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def dark():
    dark_palette = QtGui.QPalette()
    dark_palette.setColor(QtGui.QPalette.Window, QtGui.QColor(53, 53, 53))
    dark_palette.setColor(QtGui.QPalette.WindowText, white)
    dark_palette.setColor(QtGui.QPalette.Base, QtGui.QColor(25, 25, 25))
    dark_palette.setColor(QtGui.QPalette.AlternateBase,
                          QtGui.QColor(53, 53, 53))
    dark_palette.setColor(QtGui.QPalette.ToolTipBase, white)
    dark_palette.setColor(QtGui.QPalette.ToolTipText, white)
    dark_palette.setColor(QtGui.QPalette.Text, white)
    dark_palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53, 53, 53))
    dark_palette.setColor(QtGui.QPalette.ButtonText, white)
    dark_palette.setColor(QtGui.QPalette.BrightText, red)
    dark_palette.setColor(QtGui.QPalette.Link, QtGui.QColor(42, 130, 218))
    dark_palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(42, 130, 218))
    dark_palette.setColor(QtGui.QPalette.HighlightedText, black)
    return dark_palette


# /graphics/projects/opt_Ubuntu16.04/QT/share/pygt5/pyuic5 main.ui -o main.py 
开发者ID:cgtuebingen,项目名称:will-people-like-your-image,代码行数:22,代码来源:gui.py

示例8: setbgColor

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def setbgColor(self,title,var,color):
        labelcolor = QColor(color)
        colorf = self.aw.colordialog(labelcolor)
        if colorf.isValid():
            color = str(colorf.name())
            self.aw.updateCanvasColors()
            tc = self.aw.labelBorW(color)
            var.setText(colorf.name())
            var.setStyleSheet("QPushButton { background-color: " + color + "; color: " + tc + ";" + self.commonstyle + "}");
#  is this needed?            var.setPalette(QPalette(colorf))
            self.aw.qmc.fig.canvas.redraw(recomputeAllDeltas=False)
            if title == "ET":
                self.aw.qmc.backgroundmetcolor = color
            elif title == "BT":
                self.aw.qmc.backgroundbtcolor = color
            elif title == "DeltaET":
                self.aw.qmc.backgrounddeltaetcolor = color
            elif title == "DeltaBT":
                self.aw.qmc.backgrounddeltabtcolor = color
            elif title == "Extra1":
                self.aw.qmc.backgroundxtcolor = color
            elif title == "Extra2":
                self.aw.qmc.backgroundytcolor = color
            self.aw.sendmessage(QApplication.translate("Message","Color of {0} set to {1}", None).format(title,str(color))) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:26,代码来源:colors.py

示例9: setColor

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def setColor(self,title,var,color):
        labelcolor = QColor(self.aw.qmc.palette[color])
        colorf = self.aw.colordialog(labelcolor)
        if colorf.isValid():
            self.aw.qmc.palette[color] = str(colorf.name())
            self.aw.updateCanvasColors()
            self.aw.applyStandardButtonVisibility()
            self.aw.update_extraeventbuttons_visibility()
            var.setText(colorf.name())
            tc = self.aw.labelBorW(self.aw.qmc.palette[color])
            var.setStyleSheet("QPushButton { background: " + self.aw.qmc.palette[color] + "; color: " + tc + ";" + self.commonstyle + "}")
#            var.setPalette(QPalette(colorf))
            self.aw.qmc.fig.canvas.redraw(recomputeAllDeltas=False)
            if title == "ET":
                self.aw.setLabelColor(self.aw.label2,QColor(self.aw.qmc.palette[color]))
            elif title == "BT":
                self.aw.setLabelColor(self.aw.label3,QColor(self.aw.qmc.palette[color]))
            elif title == "DeltaET":
                self.aw.setLabelColor(self.aw.label4,QColor(self.aw.qmc.palette[color]))
            elif title == "DeltaBT":
                self.aw.setLabelColor(self.aw.label5,QColor(self.aw.qmc.palette[color]))
            self.aw.sendmessage(QApplication.translate("Message","Color of {0} set to {1}", None).format(title,str(self.aw.qmc.palette[color]))) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:24,代码来源:colors.py

示例10: setResaltado

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def setResaltado(self, bool):
        self.resaltado = bool
        paleta = QtGui.QPalette()
        if bool:
            paleta.setColor(
                QtGui.QPalette.Base, QtGui.QColor(self.colorResaltado))
        elif self.readOnly:
            paleta.setColor(
                QtGui.QPalette.Base, QtGui.QColor(self.colorReadOnly))
        else:
            paleta.setColor(QtGui.QPalette.Base, QtGui.QColor("white"))
        self.entrada.setPalette(paleta) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:14,代码来源:widgets.py

示例11: setColor

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def setColor(self, color):
        self.colorButton.setPalette(QtGui.QPalette(color))
        paleta = QtGui.QPalette()
        paleta.setColor(QtGui.QPalette.Text, color)
        self.lineEdit.setPalette(paleta)
        self.colorChanged.emit(color.name())
        self.color = color 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:9,代码来源:widgets.py

示例12: updateUI

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def updateUI(self):
        """Update button status when cursor move"""
        self.fontComboBox.setCurrentIndex(self.fontComboBox.findText(
            self.notas.fontFamily()))
        self.FontColor.setPalette(QtGui.QPalette(self.notas.textColor()))
        self.FontSize.setCurrentIndex(self.FontSize.findText(
            str(int(self.notas.fontPointSize()))))
        self.actionNegrita.setChecked(
            self.notas.fontWeight() == QtGui.QFont.Bold)
        self.actionCursiva.setChecked(self.notas.fontItalic())
        self.actionSubrayado.setChecked(self.notas.fontUnderline())
        format = self.notas.currentCharFormat()
        self.actionTachado.setChecked(format.fontStrikeOut())
        self.actionSuperScript.setChecked(False)
        self.actionSubScript.setChecked(False)
        if format.verticalAlignment() == QtGui.QTextCharFormat.AlignSuperScript:
            self.actionSuperScript.setChecked(True)
        elif format.verticalAlignment() == QtGui.QTextCharFormat.AlignSubScript:
            self.actionSubScript.setChecked(True)
        self.actionAlinearIzquierda.setChecked(
            self.notas.alignment() == QtCore.Qt.AlignLeft)
        self.actionCentrar.setChecked(
            self.notas.alignment() == QtCore.Qt.AlignHCenter)
        self.actionJustificar.setChecked(
            self.notas.alignment() == QtCore.Qt.AlignJustify)
        self.actionAlinearDerecha.setChecked(
            self.notas.alignment() == QtCore.Qt.AlignRight) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:29,代码来源:texteditor.py

示例13: colordialog

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def colordialog(self):
        """Show dialog to choose font color"""
        dialog = QtWidgets.QColorDialog(self.notas.textColor(), self)
        if dialog.exec_():
            self.FontColor.setPalette(QtGui.QPalette(dialog.currentColor()))
            self.notas.setTextColor(dialog.currentColor())
            format = QtGui.QTextCharFormat()
            format.setForeground(dialog.currentColor())
            self.MergeFormat(format) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:11,代码来源:texteditor.py

示例14: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.chartWidth = 250
        self.chartHeight = 250

        self.setMinimumSize(self.chartWidth + 40, self.chartHeight + 40)
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:12,代码来源:Polar.py

示例15: __init__

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPalette [as 别名]
def __init__(self, name=""):
        super().__init__(name)
        self.leftMargin = 30
        self.chartWidth = 250
        self.chartHeight = 250
        self.minDisplayValue = -1
        self.maxDisplayValue = 1
        self.fixedValues = True

        self.y_action_automatic.setChecked(False)
        self.y_action_fixed_span.setChecked(True)

        self.minValue = 0
        self.maxValue = 1
        self.span = 1

        self.isInverted = False

        self.setMinimumSize(self.chartWidth + self.rightMargin + self.leftMargin,
                            self.chartHeight + self.topMargin + self.bottomMargin)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        pal = QtGui.QPalette()
        pal.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(pal)
        self.setAutoFillBackground(True) 
开发者ID:NanoVNA-Saver,项目名称:nanovna-saver,代码行数:28,代码来源:SParam.py


注:本文中的PyQt5.QtGui.QPalette方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。