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


Python QLinearGradient.setCoordinateMode方法代码示例

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


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

示例1: gradient_darker

# 需要导入模块: from PyQt4.QtGui import QLinearGradient [as 别名]
# 或者: from PyQt4.QtGui.QLinearGradient import setCoordinateMode [as 别名]
def gradient_darker(grad, factor):
    """Return a copy of the QGradient darkened by factor.

    .. note:: Only QLinearGradeint and QRadialGradient are supported.

    """
    if type(grad) is QGradient:
        if grad.type() == QGradient.LinearGradient:
            grad = sip.cast(grad, QLinearGradient)
        elif grad.type() == QGradient.RadialGradient:
            grad = sip.cast(grad, QRadialGradient)

    if isinstance(grad, QLinearGradient):
        new_grad = QLinearGradient(grad.start(), grad.finalStop())
    elif isinstance(grad, QRadialGradient):
        new_grad = QRadialGradient(grad.center(), grad.radius(),
                                   grad.focalPoint())
    else:
        raise TypeError

    new_grad.setCoordinateMode(grad.coordinateMode())

    for pos, color in grad.stops():
        new_grad.setColorAt(pos, color.darker(factor))

    return new_grad
开发者ID:DAWforever,项目名称:orange3,代码行数:28,代码来源:utils.py

示例2: create_gradient

# 需要导入模块: from PyQt4.QtGui import QLinearGradient [as 别名]
# 或者: from PyQt4.QtGui.QLinearGradient import setCoordinateMode [as 别名]
def create_gradient(base_color, stop=QPointF(0, 0),
                    finalStop=QPointF(0, 1)):
    """
    Create a default linear gradient using `base_color` .

    """
    grad = QLinearGradient(stop, finalStop)
    grad.setStops([(0.0, base_color),
                   (0.5, base_color),
                   (0.8, base_color.darker(105)),
                   (1.0, base_color.darker(110)),
                   ])
    grad.setCoordinateMode(QLinearGradient.ObjectBoundingMode)
    return grad
开发者ID:DAWforever,项目名称:orange3,代码行数:16,代码来源:utils.py

示例3: update_items

# 需要导入模块: from PyQt4.QtGui import QLinearGradient [as 别名]
# 或者: from PyQt4.QtGui.QLinearGradient import setCoordinateMode [as 别名]
    def update_items(self):
        rect_cls = QGraphicsRectItem
        nobrush = QBrush(Qt.NoBrush)
        nopen = QPen(QColor('#FFFFFF'))
        grad = Qt.NoBrush
        self.item = rect_cls()

        for codon in self.codons.keys():
            rectitem = rect_cls(self.width, self.margin,
                                self.w, self.h, parent=self.item)
            total_rea = len(self.aa_list[codon])
            if total_rea > 0:

                grad = QLinearGradient(QPointF(0, 0.5), QPointF(1, 0.5))
                grad.setCoordinateMode(QLinearGradient.ObjectBoundingMode)
                pointpos = 1.0 / total_rea
                starting = -0.001
                for reqcol, aa in enumerate(self.aa_list[codon]):
                    curcol = self.bgcolor[aa]
                    # use the same color twice to mark start and end
                    grad.setColorAt(starting + 0.001, curcol)
                    starting += pointpos
                    grad.setColorAt(starting, curcol)

                    # grad.setColorAt(starting, QColor(curcol))
            # put small rec in big rec
            # Comment award of the year !
            brush = QBrush(QColor('#CCCCCC'))
            pen = QPen(QColor('#BBBBBB'))
            if self.codons[codon]:
                brush = QBrush(grad)
                pen = QPen(QColor('#000000'))

            rectitem.setBrush(brush)
            rectitem.setPen(pen)
            # Center text according to rectitem size
            text = QGraphicsSimpleTextItem(self.codons[codon], parent=rectitem)
            text.setFont(self.font)
            text.setBrush(self.fgcolor)
            center = rectitem.boundingRect().center()
            txtw = text.boundingRect().width()
            txth = text.boundingRect().height()
            text.setPos(center.x() - txtw / 2, center.y() - txth / 2)

            self.width += self.w + self.margin

        # now plot the big rect (with margin)
        self.item.setPen(nopen)
        self.item.setBrush(nobrush)
        self.item.setRect(0, 0, self.width, self.h + (2 * self.margin))
开发者ID:UdeM-LBIT,项目名称:CoreTracker,代码行数:52,代码来源:Faces.py

示例4: __init__

# 需要导入模块: from PyQt4.QtGui import QLinearGradient [as 别名]
# 或者: from PyQt4.QtGui.QLinearGradient import setCoordinateMode [as 别名]
    def __init__(self, parent=None):
        ChartView.__init__(self, parent)
        self.dataSource = None
        pen = QPen()
        pen.setColor(QColor(20, 158, 11))
        pen.setWidthF(self.LINE_WIDTH)
        self.linePen = pen

        gradient = QLinearGradient(0, 0, 0, 1)
        gradient.setCoordinateMode(QLinearGradient.ObjectBoundingMode)
        gradient.setColorAt(0, QColor(93, 188, 86))  # dark green
        gradient.setColorAt(1, QColor(164, 216, 158))  # light green
        self.graphBrush = QBrush(gradient)
        gradient = QLinearGradient(0, 0, 0, 1)
        gradient.setCoordinateMode(QLinearGradient.ObjectBoundingMode)
        gradient.setColorAt(0, Qt.darkGray)
        gradient.setColorAt(1, Qt.lightGray)
        self.graphFutureBrush = QBrush(gradient)
开发者ID:splodingsocks,项目名称:moneyguru,代码行数:20,代码来源:graph_view.py

示例5: gradientFromColor

# 需要导入模块: from PyQt4.QtGui import QLinearGradient [as 别名]
# 或者: from PyQt4.QtGui.QLinearGradient import setCoordinateMode [as 别名]
def gradientFromColor(color):
    gradient = QLinearGradient(0, 0, 0, 1)
    gradient.setCoordinateMode(QLinearGradient.ObjectBoundingMode)
    gradient.setColorAt(0, color)
    gradient.setColorAt(1, color.lighter())
    return gradient
开发者ID:Mouchnino,项目名称:moneyguru,代码行数:8,代码来源:chart_view.py


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