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


Python QtGui.QColor方法代码示例

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


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

示例1: load_icon

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def load_icon(fname_icon):
	path_this_file = os.path.abspath(__file__)
	path_this_dir = os.path.dirname(path_this_file)
	path_icons = os.path.join(path_this_dir, '..', 'media', 'icons')
	path_icon = os.path.join(path_icons, fname_icon)

	pixmap = QtGui.QPixmap(path_icon)

	#pixmap.fill(QtGui.QColor('red'))
	#pixmap.setMask(pixmap.createMaskFromColor(QtGui.QColor('black'), QtGui.Qt.MaskOutColor))

	icon = QtGui.QIcon()
	icon.addPixmap(pixmap, QtGui.QIcon.Normal)
	icon.addPixmap(pixmap, QtGui.QIcon.Disabled)

	return icon 
开发者ID:Vector35,项目名称:debugger,代码行数:18,代码来源:ControlsWidget.py

示例2: initUI

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def initUI(self):
        self._conicalGradient = QtGui.QConicalGradient(
            self.width() / 2, self.height() / 2, 180)
        for pos, (r, g, b) in CONICAL_GRADIENT:
            self._conicalGradient.setColorAt(pos, QtGui.QColor(r, g, b))

        top = self._rect.top()
        bottom = self._rect.top() + self._rect.height()
        self._vertical_gradient = QtGui.QLinearGradient(0, top, 0, bottom)
        self._vertical_gradient.setColorAt(0.0, QtGui.QColor(*TRANSPARENT))
        self._vertical_gradient.setColorAt(1.0, QtGui.QColor(BLACK))

        left = self._rect.left()
        right = self._rect.left() + self._rect.width()
        self._horizontal_gradient = QtGui.QLinearGradient(left, 0, right, 0)
        self._horizontal_gradient.setColorAt(0.0, QtGui.QColor(WHITE)) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:18,代码来源:colorwheel.py

示例3: set_current_color

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def set_current_color(self, color):
        [r, g, b] = color.getRgb()[:3]
        self._angle = 360.0 - (QtGui.QColor(r, g, b).getHslF()[0] * 360.0)
        self._angle = self._angle if self._angle != 720.0 else 0

        x = ((((
            sorted([r, g, b], reverse=True)[0] -
            sorted([r, g, b])[0]) / 255.0) * self._rect.width()) +
             self._rect.left())

        y = ((((
            255 - (sorted([r, g, b], reverse=True)[0])) / 255.0) *
              self._rect.height()) + self._rect.top())

        self._current_color = color
        self._color_point = QtCore.QPoint(x, y)
        self.repaint() 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:19,代码来源:colorwheel.py

示例4: draw_editor

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def draw_editor(painter, rect, snap=None):
    # draw border
    pen = QtGui.QPen(QtGui.QColor('#333333'))
    pen.setStyle(QtCore.Qt.DashDotLine)
    pen.setWidth(3)
    brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 25))
    painter.setPen(pen)
    painter.setBrush(brush)
    painter.drawRect(rect)

    if snap is None:
        return
    # draw snap grid
    pen = QtGui.QPen(QtGui.QColor('red'))
    painter.setPen(pen)
    x = 0
    y = 0
    while y < rect.bottom():
        painter.drawPoint(x, y)
        x += snap[0]
        if x > rect.right():
            x = 0
            y += snap[1] 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:25,代码来源:painting.py

示例5: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def __init__(self, name=None):

        pen = QtGui.QPen(QtCore.Qt.SolidLine)
        pen.setColor(QtGui.QColor(0, 0, 0, 255))
        pen.setWidthF(0.2)
        pen.setJoinStyle(QtCore.Qt.MiterJoin)
        self.pen = pen

        self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 0, 255))
        self.font = QtGui.QFont('Decorative', 12)

        self.rect = QtCore.QRectF()
        self.shape = QtGui.QPainterPath()
        self.path = QtGui.QPainterPath()

        self.scale = (1, 1)
        self.tooltip = ''

        self.method = ''
        self.args = [] 
开发者ID:chiefenne,项目名称:PyAero,代码行数:22,代码来源:GraphicsItemsCollection.py

示例6: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)

        self.view = args[1]

        # set pen and brush (filling)
        self.pen = QtGui.QPen()
        self.pen.setStyle(QtCore.Qt.DotLine)
        self.pen.setColor(QtGui.QColor(80, 80, 100))
        self.brush = QtGui.QBrush()
        color = QtGui.QColor(20, 20, 80, 30)
        self.brush.setColor(color)
        # self.brush.setStyle(QtCore.Qt.NoBrush)
        self.brush.setStyle(QtCore.Qt.SolidPattern)

        # set style selectively for the rubberband like that
        # see: http://stackoverflow.com/questions/25642618
        # required as opacity might not work
        # NOTE: opacity removed here
        self.setStyle(QtWidgets.QStyleFactory.create('windowsvista'))

        # set boolean for allowing zoom
        self.allow_zoom = False 
开发者ID:chiefenne,项目名称:PyAero,代码行数:26,代码来源:GraphicsView.py

示例7: makeChord

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def makeChord(self):
        line = gic.GraphicsCollection()
        color = QtGui.QColor(70, 70, 70, 255)
        line.pen.setColor(color)
        line.pen.setWidthF(0.8)
        # no pen thickness change when zoomed
        line.pen.setCosmetic(True)
        # setting CustomDashLine not needed as it will be set
        # implicitely by Qt when CustomDashLine is applied
        # put it just for completness
        line.pen.setStyle(QtCore.Qt.CustomDashLine)
        stroke = 10
        dot = 2
        space = 5
        line.pen.setDashPattern([stroke, space, dot, space])
        index_min = np.argmin(self.raw_coordinates[0])
        index_max = np.argmax(self.raw_coordinates[0])
        line.Line(self.raw_coordinates[0][index_min],
                  self.raw_coordinates[1][index_min],
                  self.raw_coordinates[0][index_max],
                  self.raw_coordinates[1][index_max])

        self.chord = GraphicsItem.GraphicsItem(line)
        self.chord.setAcceptHoverEvents(False) 
开发者ID:chiefenne,项目名称:PyAero,代码行数:26,代码来源:Airfoil.py

示例8: makeSplineMarkers

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def makeSplineMarkers(self):
        """Create marker for polygon contour"""

        self.splineMarkers = list()

        for x, y in zip(*self.spline_data[0]):

            # put airfoil contour points as graphicsitem
            splinemarker = gic.GraphicsCollection()
            splinemarker.pen.setColor(QtGui.QColor(60, 60, 80, 255))
            splinemarker.brush.setColor(QtGui.QColor(180, 180, 50, 230))
            splinemarker.pen.setWidthF(1.6)
            # no pen thickness change when zoomed
            splinemarker.pen.setCosmetic(True)

            splinemarker.Circle(x, y, 0.004)

            splineMarkerItem = GraphicsItem.GraphicsItem(splinemarker)

            self.splineMarkers.append(splineMarkerItem) 
开发者ID:chiefenne,项目名称:PyAero,代码行数:22,代码来源:Airfoil.py

示例9: test_takes_with_representations_shows_in_blue

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.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)
        ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:27,代码来源:test_version_creator.py

示例10: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def __init__(self):
        super(_QDarkPalette, self).__init__()

        self._color_white = QColor(255, 255, 255)
        self._color_black = QColor(0, 0, 0)
        self._color_red = QColor(255, 0, 0)
        self._color_primary = QColor(53, 53, 53)
        self._color_secondary = QColor(35, 35, 35)
        self._color_tertiary = QColor(42, 130, 218)

        self.setColor(QPalette.Window, self._color_primary)
        self.setColor(QPalette.WindowText, self._color_white)
        self.setColor(QPalette.Base, self._color_secondary)
        self.setColor(QPalette.AlternateBase, self._color_primary)
        self.setColor(QPalette.ToolTipBase, self._color_white)
        self.setColor(QPalette.ToolTipText, self._color_white)
        self.setColor(QPalette.Text, self._color_white)
        self.setColor(QPalette.Button, self._color_primary)
        self.setColor(QPalette.ButtonText, self._color_white)
        self.setColor(QPalette.BrightText, self._color_red)
        self.setColor(QPalette.Link, self._color_tertiary)
        self.setColor(QPalette.Highlight, self._color_tertiary)
        self.setColor(QPalette.HighlightedText, self._color_black) 
开发者ID:Marten4n6,项目名称:EvilOSX,代码行数:25,代码来源:gui.py

示例11: paint

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def paint(self, painter, option, widget):
        lod = option.levelOfDetailFromTransform(painter.worldTransform())
        should_highlight = self._should_highlight()

        if should_highlight:
            pen = QPen(QColor(0, 0xfe, 0xfe), 2, self.style)
        else:
            pen = QPen(self.color, 2, self.style)
        painter.setPen(pen)

        painter.drawPath(self.path)

        # arrow
        if lod < 0.3:
            return

        # arrow
        if should_highlight:
            brush = QBrush(QColor(0, 0xfe, 0xfe))
        else:
            brush = QBrush(self.color)
        painter.setBrush(brush)
        painter.drawPolygon(self.arrow) 
开发者ID:angr,项目名称:angr-management,代码行数:25,代码来源:qgraph_arrow.py

示例12: getColor

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def getColor(color):
	if isinstance(color, QtGui.QColor) or isinstance(color, QtGui.QGradient):
		return color
	elif hasattr(color, "addColorStop"):
		return color.value
	elif not color:
		return QtCore.Qt.transparent
	else:
		if isinstance(color, int):
			color = hex(color)
			
		if color[0 : 2].lower() == "0x":
			color = "#" + color[2 ::]

		colorObj = QtGui.QColor()
		colorObj.setNamedColor(color)

		return colorObj 
开发者ID:yuehaowang,项目名称:pylash_engine,代码行数:20,代码来源:core.py

示例13: main

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def main():
    app = QApplication(sys.argv)
    viewer = quarter.QuarterWidget()

    root = coin.SoSeparator()
    root += coin.SoCone()
    root += test()

    viewer.setSceneGraph(root)
    viewer.setBackgroundColor(QColor(255, 255, 255))
    viewer.setWindowTitle("minimal")
    viewer.show()
    sys.exit(app.exec_()) 
开发者ID:coin3d,项目名称:pivy,代码行数:15,代码来源:event_callback.py

示例14: setBackgroundColor

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def setBackgroundColor(self, color):
        """Set backgroundcolor to a given QColor
          Remember that QColors are given in integers between 0 and 255, as
          opposed to SbColor4f which is in [0 ,1]. The default alpha value for
          a QColor is 255, but you'll probably want to set it to zero before
          using it as an OpenGL clear color."""
        if isinstance(color, QtGui.QColor):
            bgcolor = coin.SbColor4f(max(0, min(1, color.red() / 255.0)),
                                     max(0, min(1, color.green() / 255.0)),
                                     max(0, min(1, color.blue() / 255.0)),
                                     max(0, min(1, color.alpha() / 255.0)))
            self.sorendermanager.setBackgroundColor(bgcolor)
        else:
            self.sorendermanager.setBackgroundColor(coin.SbColor4f(color)) 
开发者ID:coin3d,项目名称:pivy,代码行数:16,代码来源:QuarterWidget.py

示例15: getBackgroundColor

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QColor [as 别名]
def getBackgroundColor(self):
        """  Returns color used for clearing the rendering area before
          rendering the scene."""

        bg = self.sorendermanager.getBackgroundColor()

        return QtGui.QColor(max(0, min(255, int(bg[0] * 255.0))),
                            max(0, min(255, int(bg[1] * 255.0))),
                            max(0, min(255, int(bg[2] * 255.0))),
                            max(0, min(255, int(bg[3] * 255.0)))) 
开发者ID:coin3d,项目名称:pivy,代码行数:12,代码来源:QuarterWidget.py


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