本文整理汇总了Python中PyQt4.QtGui.QPalette.color方法的典型用法代码示例。如果您正苦于以下问题:Python QPalette.color方法的具体用法?Python QPalette.color怎么用?Python QPalette.color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPalette
的用法示例。
在下文中一共展示了QPalette.color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setPalette
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import color [as 别名]
def setPalette(self, palette):
QFrame.setPalette(self, palette)
palette = QPalette(palette)
palette.setColor(QPalette.Window, palette.color(QPalette.Base))
palette.setColor(QPalette.Background, palette.color(QPalette.Base))
palette.setColor(QPalette.Foreground, palette.color(QPalette.Base))
palette.setColor(QPalette.AlternateBase, palette.color(QPalette.Base))
palette.setColor(QPalette.Button, palette.color(QPalette.Base))
self.checkbox.setPalette(palette)
return
示例2: __drawAxes
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import color [as 别名]
def __drawAxes(self, painter):
"""
Pozor, tato metoda vracia nove velkosti X a Y pretoze pri kresleni osi
sa rata aj s velkostou textu ktora je variabilna
"""
palette = QPalette()
penColor = QColor(palette.color(QPalette.WindowText))
ciara = QPen(penColor)
pozadieBaseColor = QColor(palette.color(QPalette.Base))
pozadieMixColor = QColor(90, 150, 250);
red = (pozadieBaseColor.red() * 4 + pozadieMixColor.red()) / 5
green = (pozadieBaseColor.green() * 4 + pozadieMixColor.green()) / 5
blue = (pozadieBaseColor.blue() * 4 + pozadieMixColor.blue()) / 5
pozadieColor = QColor(red, green, blue);
pozadie = QBrush(pozadieColor)
painter.setPen(ciara)
painter.setBrush(pozadie)
xVelkost = self.width() - (2 * self.__padding)
yVelkost = self.height() - (2 * self.__padding)
xOs = self.__calcAxesData(xVelkost, self.__xMedzery, self.__minDay, self.__maxDay)
yOs = self.__calcAxesData(yVelkost, self.__yMedzery, self.__minPoints, self.__maxPoints)
xText = self.__convertXData(xOs)
yText = self.__convertYData(yOs)
(xxText, xyText) = self.__calcMaxTextSize(self.font(), xText)
(yxText, yyText) = self.__calcMaxTextSize(self.font(), yText)
xVelkost = xVelkost - yxText
yVelkost = yVelkost - xyText
painter.translate(yxText + 5, 5)
rect = QRect(0, 0, xVelkost, yVelkost)
painter.drawRect(rect)
penColor.setAlpha(60)
painter.setPen(QPen(penColor))
for hodnota in yOs:
y = self.__getYCoord(yVelkost, hodnota)
painter.drawLine(0, y, xVelkost, y)
for hodnota in xOs:
x = self.__getXCoord(xVelkost, hodnota)
painter.drawLine(x, 0, x, yVelkost)
painter.setPen(palette.color(QPalette.WindowText))
for i in range(len(yText)):
hodnota = yOs[i]
text = yText[i]
y = self.__getYCoord(yVelkost, hodnota)
textRect = QRect(-yxText-3, y - yyText / 2, yxText, yyText)
painter.drawText(textRect, Qt.AlignRight, text)
for i in range(len(xText)):
hodnota = xOs[i]
text = xText[i]
x = self.__getXCoord(xVelkost, hodnota)
textRect = QRect(x - xxText / 2, yVelkost + xyText / 2, xxText, xyText)
painter.drawText(textRect, Qt.AlignHCenter, text)
return (xVelkost, yVelkost)
示例3: createUI
# 需要导入模块: from PyQt4.QtGui import QPalette [as 别名]
# 或者: from PyQt4.QtGui.QPalette import color [as 别名]
def createUI(self):
"""Make the window interface."""
self.videoFrame = VLCWidget()
self.videoFrame.mouseMoved.connect(self.showBar)
self.currentTime = QtGui.QLabel('--:--')
self.positionSlider = Slider(Qt.Horizontal)
self.positionSlider.setToolTip('Position')
self.positionSlider.setMaximum(1000)
self.positionSlider.sliderMoved.connect(self.setPosition)
self.totalTime = QtGui.QLabel('--:--')
timeLayout = QtGui.QHBoxLayout()
timeLayout.addWidget(self.currentTime)
timeLayout.addWidget(self.positionSlider)
timeLayout.addWidget(self.totalTime)
tool = QtGui.QToolBar()
self.playButton = tool.addAction(
QIcon(ICONS + 'play.png'), 'Play', self.playPause)
tool.addAction(
QIcon(ICONS + 'backward.png'), u'Précédent', self.previousEpisode)
tool.addAction(QIcon(ICONS + 'stop.png'), 'Stop', self.stop)
tool.addAction(
QIcon(ICONS + 'forward.png'), 'Suivant', self.nextEpisode)
tool.addSeparator()
self.playListBtn = tool.addAction(
QIcon(ICONS + 'playlist.png'), 'Playlist', self.showPlayList)
self.playListBtn.setCheckable(True)
self.autoPlay = tool.addAction(
QIcon(ICONS + 'reload.png'), 'Activer la lecture automatique')
self.autoPlay.setCheckable(True)
self.btnRandom = tool.addAction(
QIcon(ICONS + 'random.png'),
u'Jouer aléatoirement un autre épisode')
self.btnRandom.setCheckable(True)
toolRight = QtGui.QToolBar()
self.volumeBtn = toolRight.addAction(
QIcon(ICONS + 'volume-mute.png'), 'Volume', self.toggleVolume)
menu = QtGui.QMenu()
menu.addAction('Ralentir', self.speedDown)
menu.addAction('Vitesse normale', self.normalSpeed)
menu.addAction(u'Accélérer', self.speedUp)
self.toolButton = QtGui.QToolButton()
self.toolButton.setIcon(QIcon(ICONS + 'speed.png'))
self.toolButton.setToolTip('Vitesse')
self.toolButton.setMenu(menu)
self.toolButton.setPopupMode(QtGui.QToolButton.InstantPopup)
tool.addWidget(self.toolButton)
tool.addSeparator()
self.screenBtn = tool.addAction(
QIcon(ICONS + 'fullscreen.png'), u'Plein écran', self.fullScreen)
tool.addAction(
QIcon(ICONS + 'options.png'), 'Options', self.showOptionsWindow)
volume = self.mediaPlayer.audio_get_volume()
self.volumeSlider = QtGui.QSlider(Qt.Horizontal)
self.volumeSlider.setMaximum(100)
self.volumeSlider.setValue(volume)
self.volumeSlider.setToolTip('Volume')
self.volumeSlider.valueChanged.connect(self.setVolume)
self.setBtnVolume(volume)
hButtonBox = QtGui.QHBoxLayout()
hButtonBox.addWidget(tool)
hButtonBox.addStretch(1)
hButtonBox.addWidget(toolRight)
hButtonBox.addWidget(self.volumeSlider)
vBoxLayout = QtGui.QVBoxLayout()
vBoxLayout.addLayout(timeLayout)
vBoxLayout.addLayout(hButtonBox)
self.playList = QtGui.QListWidget()
self.playList.currentRowChanged.connect(self.changeEpisode)
self.playList.hide()
palette = QPalette()
palette.setColor(QPalette.Window, palette.color(QPalette.Window))
self.currentEpisodeWidget = Episode()
self.currentEpisodeWidget.setObjectName('currentEpisode')
self.currentEpisodeWidget.setPalette(palette)
self.currentEpisodeWidget.setAutoFillBackground(True)
self.currentEpisodeWidget.hide()
self.bar = QtGui.QWidget()
self.bar.setObjectName('tool')
self.bar.hide()
self.drawBar()
self.bar.setLayout(vBoxLayout)
#.........这里部分代码省略.........