本文整理汇总了Python中PyQt5.QtGui.QPalette.setColor方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.setColor方法的具体用法?Python QPalette.setColor怎么用?Python QPalette.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QPalette
的用法示例。
在下文中一共展示了QPalette.setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createDisplay
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def createDisplay(self):
self.displayLCD = QGroupBox("")
layout = QHBoxLayout()
paletteLosses = QPalette()
paletteVictory = QPalette()
paletteLosses.setColor(paletteLosses.WindowText, QColor(255, 000, 000))
paletteVictory.setColor(paletteVictory.WindowText, QColor(000, 255, 000))
self.lossesLcd = QLCDNumber(3)
self.lossesLcd.setSegmentStyle(QLCDNumber.Filled)
self.lossesLcd.setPalette(paletteLosses)
self.victoryLcd = QLCDNumber(3)
self.victoryLcd.setSegmentStyle(QLCDNumber.Filled)
self.victoryLcd.setPalette(paletteVictory)
self.lossesLcd.setMinimumHeight(100)
self.victoryLcd.setMinimumHeight(100)
self.lossesLcd.setMinimumWidth(150)
self.victoryLcd.setMinimumWidth(150)
layout.addWidget(self.victoryLcd)
layout.addWidget(self.lossesLcd)
self.displayLCD.setLayout(layout)
示例2: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def __init__(self, parent=None, interval=50):
QWidget.__init__(self, parent)
palette = QPalette(self.palette())
palette.setColor(palette.Background, Qt.transparent)
self.setPalette(palette)
self.counter = 0
self.interval = interval
示例3: start_report
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def start_report(self):
self.viewQueues.start()
self.setEnabled(False)
bgColor = QPalette()
bgColor.setColor(self.backgroundRole(), Qt.lightGray)
self.setPalette(bgColor)
self.myLoadingMovie.show()
示例4: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def __init__(self, *args, **kwargs):
super(ImageViewerCenter, self).__init__(*args, **kwargs)
self.zoomMode = ZOOM_FACTOR
self.zoomFactor = 1
self.moving = None
imgWidget = QLabel()
imgWidget.setMouseTracking(True)
imgWidget.setAlignment(Qt.AlignCenter)
self.setWidget(imgWidget)
self.setAlignment(Qt.AlignCenter)
self.setMouseTracking(True)
self.setFrameShape(self.NoFrame)
self.setWidgetResizable(True)
pal = QPalette()
pal.setColor(QPalette.Window, Qt.black)
self.setPalette(pal)
self.leftZone = False
self.topZone = False
self.file = None
self.movie = None
示例5: setBackGround
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def setBackGround(self,backColor):
if self.isSetBackground : return
palette = QPalette()
palette.setColor(QPalette.Background,backColor)
self.setAutoFillBackground(True)
self.setPalette(palette);
self.isSetBackground = True
示例6: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def __init__(self):
super(AvailableSizes, self).__init__()
self.createCombos()
self.createHeader()
#self.createMenuBar()
self.printOut = QTextEdit()
self.printOut.setFont(QFont('Helvetica', 11, QFont.Bold))
self.printOut.setReadOnly(True)
mainLayout = QVBoxLayout()
#mainLayout.setMenuBar(self.menuBar)
mainLayout.addWidget(self.frmHeader)
mainLayout.addWidget(self.grpBox)
mainLayout.addWidget(self.printOut)
#mainLayout.setAlignment(self.frmHeader, Qt.AlignRight)
self.setLayout(mainLayout)
#self.setWindowTitle("Available Sizes")
self.setWindowFlags(Qt.FramelessWindowHint)
bgColor = QPalette()
bgColor.setColor(self.backgroundRole(), Qt.gray)
self.setPalette(bgColor)
self.setWindowIcon(QIcon('icon/PS_Icon.png'))
self.cbSku.setFocus()
示例7: initUI
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def initUI(self):
"""Creates parts of layout that account for sizes.
Notable is that the boardScene squares will be a multiple of 8."""
screens = [QDesktopWidget().availableGeometry(i) for i in
range(QDesktopWidget().screenCount())]
assert screens
maxWidth = max(min(s.width(), s.height()) for s in screens)
sceneWidth = int(maxWidth / 8) * 8
self.boardScene.initSquares(sceneWidth / 8)
self.boardScene.setSceneRect(0, 0, sceneWidth, sceneWidth)
self.boardSceneView.initUI(sceneWidth)
"""Creates layout without accounting for sizes"""
pal = QPalette(self.palette())
pal.setColor(QPalette.Background, Qt.green)
self.setAutoFillBackground(True)
self.setPalette(pal)
self.vertLayout = QVBoxLayout(self)
self.vertLayout.setSpacing(0)
self.vertLayout.setContentsMargins(0, 0, 0, 0)
self.vertLayout.addWidget(self.moveTreeView)
self.vertLayout.addWidget(self.engineWidget)
self.vertWidget = QWidget(self)
self.vertWidget.setLayout(self.vertLayout)
horiLayout = QHBoxLayout(self)
horiLayout.setSpacing(0)
horiLayout.setContentsMargins(0, 0, 0, 0)
horiLayout.addWidget(self.boardSceneView)
horiLayout.addWidget(self.vertWidget)
self.setLayout(horiLayout)
示例8: create_table
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def create_table(self, tblType):
data = self.db.get_table_data(tblType)
font = QFont('Veranda', 12, QFont.Bold)
blk = QPalette()
blk.setColor(blk.Foreground, Qt.black)
# Check to make sure the list is there and has data, then we go through it and add data to the table.
if data:
self.tblSummary.setRowCount(len(data))
for i, row in enumerate(data):
for j, col in enumerate(row):
item = QTableWidgetItem(str(col))
item.setFont(font)
#item.setForeground(QColor.fr
#item.setFlags(Qt.ItemIsEditable)
if item.text() == "None":
item.setText("")
self.tblSummary.setItem(i, j, item)
else:
self.tblSummary.setRowCount(1)
item = QTableWidgetItem()
item.setText("Nothing Found")
self.tblSummary.setItem(0, 0, item)
示例9: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def __init__(self):
super().__init__()
self.setGeometry(600, 200, 420, 320)
self.setWindowTitle('Help')
self.setWindowIcon(QIcon(ICON_PATH))
label = QLabel('Press anything on your keyboard to see what it does.')
self.actionLabel = QLabel('Press something!')
self.img = QLabel('img', self)
self.img.setPixmap(QPixmap(HELP_IMG_PATH))
grid = QGridLayout()
grid.setSpacing(4)
grid.addWidget(self.img, 0, 0)
grid.addWidget(label, 1, 0)
grid.addWidget(self.actionLabel, 2, 0)
myFont=QFont()
myFont.setBold(True)
myFont.setPixelSize(24)
self.actionLabel.setFont(myFont)
palette = QPalette()
palette.setColor(QPalette.Foreground,Qt.green)
self.actionLabel.setPalette(palette)
self.setLayout(grid)
self.show()
示例10: init
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def init(self):
self.cpus=multiprocessing.cpu_count()
self.tab.setTabsClosable(True)
self.tab.setMovable(True)
self.tab.setTabBar(QHTabBar())
self.tab.setTabPosition(QTabWidget.West)
self.font = QFont()
self.font.setFamily('Monospace')
self.font.setStyleHint(QFont.Monospace)
self.font.setFixedPitch(True)
self.font.setPointSize(int(12))
self.terminals=[]
self.process=[]
for i in range(0,self.cpus):
term=QTextEdit()
term.setFont(self.font)
pal = QPalette()
bgc = QColor(0, 0, 0)
pal.setColor(QPalette.Base, bgc)
textc = QColor(230, 230, 230)
pal.setColor(QPalette.Text, textc)
term.setPalette(pal)
proc=QProcess(self)
proc.readyRead.connect(functools.partial(self.dataReady,i))
self.process.append(proc)
self.terminals.append(term)
self.tab.addTab(term,"cpu "+str(i))
示例11: set_pen_color
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def set_pen_color(self, label):
color = QColorDialog.getColor()
if color.isValid():
self.pen = QPen(color, self.pen.width())
label_palette = QPalette()
label_palette.setColor(QPalette.WindowText, color)
label.setPalette(label_palette)
label.setText("Цвет линии " + color.name())
self.update()
示例12: set_faces_color
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def set_faces_color(self, label):
color = QColorDialog.getColor()
if color.isValid():
self.faces_color = color
label_palette = QPalette()
label_palette.setColor(QPalette.WindowText, color)
label.setPalette(label_palette)
label.setText("Цвет объекта " + color.name())
self.update()
示例13: __init__
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def __init__(self, parent = None):
QWidget.__init__(self, parent)
palette = QPalette(self.palette())
palette.setColor(palette.Background, Qt.transparent)
self.setPalette(palette)
self.MINCOUNTER = 10
self.minloopkeep = False
示例14: Monitor
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
class Monitor(QLabel):
def __init__(self, parent):
QLabel.__init__(self, '[ Mon ]', parent)
self.setAutoFillBackground(True)
def setColor(self, r, g, b):
self.palette = QPalette()
self.palette.setColor(QPalette.Background, QColor(round(r*255), round(g*255), round(b*255)))
self.setPalette(self.palette)
示例15: initUI
# 需要导入模块: from PyQt5.QtGui import QPalette [as 别名]
# 或者: from PyQt5.QtGui.QPalette import setColor [as 别名]
def initUI(self):
self.viewer_layout = QVBoxLayout()
horizontal_layout = QHBoxLayout()
viewer_widget_palette = QPalette()
viewer_widget_palette.setColor(QPalette.Background, QColor(constants.defaultViewerColor))
self.setAutoFillBackground(True)
self.setPalette(viewer_widget_palette)
horizontal_layout.addLayout(self.viewer_layout)
self.setLayout(horizontal_layout)