本文整理汇总了Python中PyQt5.QtGui.QPalette类的典型用法代码示例。如果您正苦于以下问题:Python QPalette类的具体用法?Python QPalette怎么用?Python QPalette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPalette类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_table
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)
示例2: __init__
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()
示例3: setBackGround
def setBackGround(self,backColor):
if self.isSetBackground : return
palette = QPalette()
palette.setColor(QPalette.Background,backColor)
self.setAutoFillBackground(True)
self.setPalette(palette);
self.isSetBackground = True
示例4: start_report
def start_report(self):
self.viewQueues.start()
self.setEnabled(False)
bgColor = QPalette()
bgColor.setColor(self.backgroundRole(), Qt.lightGray)
self.setPalette(bgColor)
self.myLoadingMovie.show()
示例5: initUI
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)
示例6: __init__
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: updateFilledCircle
def updateFilledCircle(self, s):
size = s * self.zoom
pixmap = QPixmap(self.width(), self.height())
pixmap.fill(Qt.transparent)
#painter filled ellipse
p = QPalette()
painter = QPainter()
painter.begin(pixmap)
painter.setRenderHint(QPainter.Antialiasing)
brush = QBrush(p.link().color())
painter.setBrush(brush)
painter.setOpacity(0.4)
painter.drawEllipse(QRect(old_div(self.width(),2) - old_div(size,2), old_div(self.height(),2) - old_div(size,2), size, size))
painter.end()
#painter ellipse 2
painter2 = QPainter()
painter2.begin(pixmap)
painter2.setRenderHint(QPainter.Antialiasing)
pen2 = QPen(Qt.green)
pen2.setWidth(1)
painter2.setPen(pen2)
painter2.drawEllipse(QRect(old_div(self.width(),2) - old_div(size,2), old_div(self.height(),2) - old_div(size,2), size, size))
painter2.end()
self.ellipseLabel.setPixmap(QPixmap(pixmap))
self.lastSize = s
示例8: __init__
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
示例9: init
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))
示例10: RoundedPushButton1
class RoundedPushButton1(QPushButton):
def __init__(self,parent, default_wide, default_high,text=''):
QPushButton.__init__(self, parent)
#self.resize(100,80)
self.default_high=default_high
self.default_wide=default_wide
self.xrd=self.default_wide/10
#self.yrd=self.default_high/10
self.yrd=self.xrd
#self.resize(self.default_wide,self.default_high)
self.backgroundColor = QPalette().light().color()
self.backgroundColor.setRgb(157,157,157) #(220,203,231)
#self.backgroundColor.setAlpha(0)
self.brush=QBrush(Qt.SolidPattern)
self.textlabel=textQLabel(self,text)
def paintEvent(self,event):
#brush.setStyle(Qt.Dense1Pattern)
self.brush.setColor(self.backgroundColor)
self.painter=QPainter(self)
self.painter.setRenderHint(QPainter.Antialiasing)
self.painter.setPen(Qt.NoPen)
self.painter.setBrush(self.brush)
self.painter.drawRoundedRect(QRect(0,0,self.default_wide,self.default_high), self.xrd, self.yrd)
#self.painter.drawPixmap(self.imgx, self.imgy, self.piximg)
self.painter.end()
示例11: __init__
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
示例12: __init__
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
示例13: set_pen_color
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()
示例14: set_faces_color
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()
示例15: Monitor
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)