本文整理汇总了Python中PySide.QtGui.QColor方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QColor方法的具体用法?Python QtGui.QColor怎么用?Python QtGui.QColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_data_to_table
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def add_data_to_table(self, route):
self.tableWidget_path.setRowCount(len(route))
for i, row in enumerate(route):
for j, col in enumerate(row):
item = QtGui.QTableWidgetItem("{}".format(col))
self.tableWidget_path.setItem(i, j, item)
if j in [1, 2]:
self.tableWidget_path.item(i, j).setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
if row[1] == "HS":
color = QtGui.QColor(223, 240, 216)
elif row[1] == "LS":
color = QtGui.QColor(252, 248, 227)
elif row[1] == "NS":
color = QtGui.QColor(242, 222, 222)
else:
color = QtGui.QColor(210, 226, 242)
if j == 3 and "wormhole" in col:
self.tableWidget_path.item(i, j).setIcon(self.icon_wormhole)
self.tableWidget_path.item(i, j).setBackground(color)
self.tableWidget_path.item(i, j).setForeground(QtGui.QColor(0, 0, 0))
示例2: test_takes_with_representations_shows_in_blue
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def test_takes_with_representations_shows_in_blue(self):
"""testing if takes with representations will be displayed in blue
"""
# select project 1 -> task1
item_model = self.dialog.tasks_treeView.model()
selection_model = self.dialog.tasks_treeView.selectionModel()
index = item_model.index(0, 0)
project1_item = item_model.itemFromIndex(index)
self.dialog.tasks_treeView.expand(index)
task1_item = project1_item.child(0, 0)
selection_model.select(
task1_item.index(),
QtGui.QItemSelectionModel.Select
)
# expect only one "Main" take listed in take_listWidget
main_item = self.dialog.takes_listWidget.item(0)
item_foreground = main_item.foreground()
color = item_foreground.color()
self.assertEqual(
color,
QtGui.QColor(0, 0, 255)
)
示例3: drawBars
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def drawBars(self, painter):
size = self.size()
width = size.width()
height = size.height()
bar_width = float(width - self.padding) / self.bars_number
color = QtGui.QColor(0, 0, 0)
painter.setPen(color)
painter.setBrush(color)
painter.drawRect(0, 0, width, height)
for bar, value in enumerate(self.bars):
bar_height = (height - self.padding) * value / self.resolution
if not bar_height:
bar_height = 1
painter.setBrush(self.barColor(bar))
painter.drawRect(
bar * bar_width + self.padding,
height - bar_height,
bar_width - self.padding,
bar_height - self.padding)
示例4: showAbout
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def showAbout(self):
widget = QtGui.QDialog(self)
widget.setWindowTitle("About PySimulator")
p = QtGui.QPalette()
p.setColor(QtGui.QPalette.Background, QtGui.QColor("white"))
widget.setPalette(p)
layout = QtGui.QGridLayout(widget)
widget.setLayout(layout)
pixmap = QtGui.QPixmap(self.rootDir + "/Icons/dlr-splash.png")
iconLabel = QtGui.QLabel()
iconLabel.setPixmap(pixmap)
layout.addWidget(iconLabel, 0, 0)
layout.addWidget(QtGui.QLabel("Copyright (C) 2011-2015 German Aerospace Center DLR (Deutsches Zentrum fuer Luft- und Raumfahrt e.V.),\nInstitute of System Dynamics and Control. All rights reserved.\n\nPySimulator is free software: You can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nPySimulator is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with PySimulator. If not, see www.gnu.org/licenses."), 1, 0)
layout.addWidget(QtGui.QLabel("PySimulator Version: " + str(version)), 2, 0)
button = QtGui.QPushButton("OK")
button.clicked.connect(widget.close)
layout.addWidget(button, 3, 0)
widget.show()
示例5: _newPlotContainer
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def _newPlotContainer(self):
''' Create a new plot and add it to the current tab '''
plotContainer = plotWidget.plotContainer(self.mdi)
# defaultWidget = plotWidget.DefaultPlotWidget(self, self.plotMenuCallbacks)
# plotContainer.addRight(defaultWidget)
plotContainer.addFirst(self, self.plotMenuCallbacks)
self.plotContainers.append(plotContainer)
plotContainer.activeWidgetChanged.connect(self._currentPlotChanged)
plotContainer.closed.connect(self._removePlotContainer)
window = self.mdi.addSubWindow(plotContainer)
self.plotWindowNr += 1
window.setWindowTitle("Tab " + str(self.plotWindowNr))
p = QtGui.QPalette()
p.setColor(QtGui.QPalette.Background, QtGui.QColor("white"))
window.setPalette(p)
window.setWindowIcon(QtGui.QIcon(self.rootDir + '/Icons/office-chart-line-stacked.png'))
window.showMaximized()
return plotContainer
示例6: heatmap
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def heatmap(self, width, height, points):
base_image = QtGui.QImage(width, height, QtGui.QImage.Format_ARGB32)
base_image.fill(QtGui.QColor(255, 255, 255, 255))
self._paint_points(base_image, points)
return self._qimage_to_pil_image(base_image).convert('L')
示例7: _paint_points
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def _paint_points(self, img, points):
painter = QtGui.QPainter(img)
painter.setRenderHint(QtGui.QPainter.Antialiasing)
pen = QtGui.QPen(QtGui.QColor(0, 0, 0, 0))
pen.setWidth(0)
painter.setPen(pen)
for point in points:
self._paint_point(painter, *point)
painter.end()
示例8: _paint_point
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def _paint_point(self, painter, x, y):
grad = QtGui.QRadialGradient(x, y, self.point_diameter/2)
grad.setColorAt(0, QtGui.QColor(0, 0, 0, max(self.point_strength, 0)))
grad.setColorAt(1, QtGui.QColor(0, 0, 0, 0))
brush = QtGui.QBrush(grad)
painter.setBrush(brush)
painter.drawEllipse(
x - self.point_diameter/2,
y - self.point_diameter/2,
self.point_diameter,
self.point_diameter
)
示例9: get_QColor
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def get_QColor():
"""QColor getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QColor
except ImportError:
import PyQt5.QtGui as QtGui
return QtGui.QColor
示例10: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def __init__(self, *args, **kwargs):
QtGui.QFrame.__init__(self)
Custom.__init__(self, *args, **kwargs)
self.setFrameStyle(QtGui.QFrame.VLine | QtGui.QFrame.Plain)
palette = self.palette()
palette.setColor(self.foregroundRole(), QtGui.QColor(0, 0, 0, 0))
self.setPalette(palette)
margin = 4
self.setContentsMargins(margin, 0, margin, 0)
示例11: rgb
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def rgb(red, green, blue):
return QtGui.QColor(red, green, blue)
示例12: set_shadow_effect
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def set_shadow_effect(self, widget, radius=5, offset=(1, 1)):
shadow_effect = QtGui.QGraphicsDropShadowEffect(self)
shadow_effect.setBlurRadius(radius)
shadow_effect.setColor(QtGui.QColor("#000000"))
shadow_effect.setOffset(*offset)
widget.setGraphicsEffect(shadow_effect)
示例13: _create_metallic_roughness_map
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def _create_metallic_roughness_map(self, metal_map, rough_map):
metal = QImage(metal_map)
rough = QImage(rough_map)
metal_pixel = QColor()
metal = metal.convertToFormat(QImage.Format_RGB32);
rough = rough.convertToFormat(QImage.Format_RGB32);
metal_uchar_ptr = metal.bits()
rough_uchar_ptr = rough.bits()
if (not metal.width() == rough.width()
or not metal.height() == rough.height()):
raise RuntimeError("Error processing material: {}. Metallic map and roughness map must have same dimensions.".format(self.maya_node))
width = metal.width();
height = metal.height();
i = 0
for y in range(height):
for x in range(width):
metal_color = struct.unpack('I', metal_uchar_ptr[i:i+4])[0]
rough_color = struct.unpack('I', rough_uchar_ptr[i:i+4])[0]
metal_pixel.setRgb(0, qGreen(rough_color), qBlue(metal_color))
metal_uchar_ptr[i:i+4] = struct.pack('I', metal_pixel.rgb())
i+=4
output = ExportSettings.out_dir + "/"+self.name+"_metalRough.jpg"
return output, metal
示例14: initUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def initUI(self):
# container = QWidget(self)
# container.resize(200, 100);
# container.setStyleSheet("background-color:black;")
font_size = QLabel('Font Size')
font_size.fillColor = QColor(30, 30, 30, 120)
font_size.penColor = QColor("#333333")
grid = QGridLayout()
grid.setContentsMargins(50, 10, 10, 10)
grid.addWidget(font_size, 0, 0)
self.setLayout(grid)
# palette = QPalette(self.palette())
# palette.setColor(self.backgroundRole(), Qt.black)
# palette.setColor(palette.Background, Qt.transparent)
# self.setPalette(palette)
# def paintEvent(self, event):
# painter = QPainter()
# painter.begin(self)
# # painter.setRenderHint(QPainter.Antialiasing)
# painter.fillRect(event.rect(), QBrush(QColor(255, 255, 255, 127)))
# painter.drawLine(self.width() / 8, self.height() / 8, 7 * self.width() / 8, 7 * self.height() / 8)
# painter.drawLine(self.width() / 8, 7 * self.height() / 8, 7 * self.width() / 8, self.height() / 8)
# # painter.setPen(QPen(Qt.NoPen))
示例15: highlightCurrentLine
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QColor [as 别名]
def highlightCurrentLine(self):
extraSelections = []
if (not self.isReadOnly()):
lineColor = QColor("#E0EEEE")
selection = QTextEdit.ExtraSelection()
selection.format.setBackground(lineColor)
selection.format.setProperty(QTextCharFormat.FullWidthSelection, True)
selection.cursor=self.textCursor()
selection.cursor.clearSelection()
extraSelections.append(selection)
self.setExtraSelections(extraSelections)