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


Python functions.mkPen函数代码示例

本文整理汇总了Python中pyqtgraph.functions.mkPen函数的典型用法代码示例。如果您正苦于以下问题:Python mkPen函数的具体用法?Python mkPen怎么用?Python mkPen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, orientation='bottom', allowAdd=True, **kargs):
     """
     ============= =================================================================================
     **Arguments**
     orientation   Set the orientation of the gradient. Options are: 'left', 'right'
                   'top', and 'bottom'.
     allowAdd      Specifies whether ticks can be added to the item by the user.
     tickPen       Default is white. Specifies the color of the outline of the ticks.
                   Can be any of the valid arguments for :func:`mkPen <pyqtgraph.mkPen>`
     ============= =================================================================================        
     """
     ## public
     GraphicsWidget.__init__(self)
     self.orientation = orientation
     self.length = 100
     self.tickSize = 15
     self.ticks = {}
     self.maxDim = 20
     self.allowAdd = allowAdd
     if 'tickPen' in kargs:
         self.tickPen = fn.mkPen(kargs['tickPen'])
     else:
         self.tickPen = fn.mkPen('w')
         
     self.orientations = {
         'left': (90, 1, 1), 
         'right': (90, 1, 1), 
         'top': (0, 1, -1), 
         'bottom': (0, 1, 1)
     }
     
     self.setOrientation(orientation)
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:32,代码来源:GradientEditorItem.py

示例2: paint

 def paint(self, p, *args):
     opts = self.opts
     if opts.get('antialias', True):
         p.setRenderHint(p.Antialiasing)
     
     if opts.get('fillLevel', None) is not None and opts.get('fillBrush', None) is not None:
         p.setBrush(fn.mkBrush(opts['fillBrush']))
         p.setPen(fn.mkPen(None))
         p.drawPolygon(QtGui.QPolygonF([
             QtCore.QPointF(2, 18), 
             QtCore.QPointF(18, 2), 
             QtCore.QPointF(18, 18)]))
     
     if opts.get('pen', None) is not None:
         p.setPen(fn.mkPen(opts['pen']))
         p.drawLine(2, 18, 18, 2)
     
     symbol = opts.get('symbol', None)
     if symbol is not None:
             
         pen = fn.mkPen(opts.get('symbolPen', None))
         brush = fn.mkBrush(opts.get('symbolBrush', None))
         size = opts.get('symbolSize', 10)
         
         p.translate(10,10)
         path = drawSymbol(p, symbol, size, pen, brush)
开发者ID:corinneteeter,项目名称:multipatch_analysis,代码行数:26,代码来源:throughput.py

示例3: __init__

    def __init__(self, node):
        #QtGui.QGraphicsItem.__init__(self)
        GraphicsObject.__init__(self)
        #QObjectWorkaround.__init__(self)
        
        #self.shadow = QtGui.QGraphicsDropShadowEffect()
        #self.shadow.setOffset(5,5)
        #self.shadow.setBlurRadius(10)
        #self.setGraphicsEffect(self.shadow)
        
        self.pen = fn.mkPen(0,0,0)
        self.selectPen = fn.mkPen(200,200,200,width=2)
        self.brush = fn.mkBrush(200, 200, 200, 150)
        self.hoverBrush = fn.mkBrush(200, 200, 200, 200)
        self.selectBrush = fn.mkBrush(200, 200, 255, 200)
        self.hovered = False
        
        self.node = node
        flags = self.ItemIsMovable | self.ItemIsSelectable | self.ItemIsFocusable |self.ItemSendsGeometryChanges
        #flags =  self.ItemIsFocusable |self.ItemSendsGeometryChanges

        self.setFlags(flags)
        self.bounds = QtCore.QRectF(0, 0, 100, 100)
        self.nameItem = QtGui.QGraphicsTextItem(self.node.name(), self)
        self.nameItem.setDefaultTextColor(QtGui.QColor(50, 50, 50))
        self.nameItem.moveBy(self.bounds.width()/2. - self.nameItem.boundingRect().width()/2., 0)
        self.nameItem.setTextInteractionFlags(QtCore.Qt.TextEditorInteraction)
        self.updateTerminals()
        #self.setZValue(10)

        self.nameItem.focusOutEvent = self.labelFocusOut
        self.nameItem.keyPressEvent = self.labelKeyPress
        
        self.menu = None
        self.buildMenu()
开发者ID:initbrain,项目名称:intelwiz,代码行数:35,代码来源:Node.py

示例4: buildTorque

 def buildTorque(self):
     self.pTorque = self.win.addPlot(title="Torque")
     self.pTorque.showGrid(x=True, y=True)
     self.pTorqueCurves[0] = self.pTorque.plot(pen="r")
     self.pTorqueCurves[1] = self.pTorque.plot(pen="b")
     self.pTorqueCurves[2] = self.pTorque.plot(pen="g")
     self.pTorqueCurves[3] = self.pTorque.plot(pen=mkPen(color="r", style=QtCore.Qt.DotLine))
     self.pTorqueCurves[4] = self.pTorque.plot(pen=mkPen(color="b", style=QtCore.Qt.DotLine))
     self.pTorqueCurves[5] = self.pTorque.plot(pen=mkPen(color="g", style=QtCore.Qt.DotLine))
开发者ID:nlurkin,项目名称:Drone,代码行数:9,代码来源:DronePlot.py

示例5: buildQuaternion

 def buildQuaternion(self):
     self.pQuat = self.win.addPlot(title="Quaternion")
     self.pQuat.showGrid(x=True, y=True)
     self.pQuatCurves[0] = self.pQuat.plot(pen="r")
     self.pQuatCurves[1] = self.pQuat.plot(pen="g")
     self.pQuatCurves[2] = self.pQuat.plot(pen="b")
     self.pQuatCurves[3] = self.pQuat.plot(pen=mkPen(color="r", style=QtCore.Qt.DotLine))
     self.pQuatCurves[4] = self.pQuat.plot(pen=mkPen(color="b", style=QtCore.Qt.DotLine))
     self.pQuatCurves[5] = self.pQuat.plot(pen=mkPen(color="g", style=QtCore.Qt.DotLine))
开发者ID:nlurkin,项目名称:Drone,代码行数:9,代码来源:DronePlot.py

示例6: paint

 def paint(self, p, *args):
     if self.isSelected():
         p.setPen(fn.mkPen(200, 200, 0, width=3))
     else:
         if self.hovered:
             p.setPen(fn.mkPen(150, 150, 250, width=1))
         else:
             p.setPen(fn.mkPen(100, 100, 250, width=1))
             
     p.drawLine(0, 0, 0, self.length)
开发者ID:archphy,项目名称:poropy,代码行数:10,代码来源:Terminal.py

示例7: __init__

 def __init__(self):
     self.penActive   = fn.mkPen(  0, 255, 0)
     self.penInactive = fn.mkPen(255,   0, 0) 
     self.penHover    = fn.mkPen(255, 255, 0)   
     self.penActive.setWidth(1)
     self.penInactive.setWidth(1) 
     self.penHover.setWidth(1)   
     self.setName()
     self.isSelected = False
     self.menu = None
     self.setActive(True)
开发者ID:Frikster,项目名称:ROIviewbox,代码行数:11,代码来源:ROI.py

示例8: paint

 def paint(self, p, *args):
     if self.isSelected():
         p.setPen(fn.mkPen(self.style['selectedColor'], width=self.style['selectedWidth']))
     else:
         if self.hovered:
             p.setPen(fn.mkPen(self.style['hoverColor'], width=self.style['hoverWidth']))
         else:
             p.setPen(fn.mkPen(self.style['color'], width=self.style['width']))
             
     #p.drawLine(0, 0, 0, self.length)
     
     p.drawPath(self.path)
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:12,代码来源:Terminal.py

示例9: addAvgCurve

 def addAvgCurve(self, curve):
     ## Add a single curve into the pool of curves averaged together
     
     ## If there are plot parameters, then we need to determine which to average together.
     remKeys = []
     addKeys = []
     if self.ctrl.avgParamList.count() > 0:
     
         ### First determine the key of the curve to which this new data should be averaged
         for i in range(self.ctrl.avgParamList.count()):
             item = self.ctrl.avgParamList.item(i)
             if item.checkState() == QtCore.Qt.Checked:
                 remKeys.append(str(item.text()))
             else:
                 addKeys.append(str(item.text()))
                 
         if len(remKeys) < 1:  ## In this case, there would be 1 average plot for each data plot; not useful.
             return
             
     p = self.itemMeta.get(curve,{}).copy()
     for k in p:
         if type(k) is tuple:
             p['.'.join(k)] = p[k]
             del p[k]
     for rk in remKeys:
         if rk in p:
             del p[rk]
     for ak in addKeys:
         if ak not in p:
             p[ak] = None
     key = tuple(p.items())
     
     ### Create a new curve if needed
     if key not in self.avgCurves:
         plot = PlotDataItem()
         plot.setPen(fn.mkPen([0, 200, 0]))
         plot.setShadowPen(fn.mkPen([0, 0, 0, 100], width=3))
         plot.setAlpha(1.0, False)
         plot.setZValue(100)
         self.addItem(plot, skipAverage=True)
         self.avgCurves[key] = [0, plot]
     self.avgCurves[key][0] += 1
     (n, plot) = self.avgCurves[key]
     
     ### Average data together
     (x, y) = curve.getData()
     if plot.yData is not None:
         newData = plot.yData * (n-1) / float(n) + y * 1.0 / float(n)
         plot.setData(plot.xData, newData)
     else:
         plot.setData(x, y)
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:51,代码来源:PlotItem.py

示例10: setSymbolPen

 def setSymbolPen(self, *args, **kargs):
     pen = fn.mkPen(*args, **kargs)
     if self.opts['symbolPen'] == pen:
         return
     self.opts['symbolPen'] = pen
     #self.scatter.setSymbolPen(pen)
     self.updateItems()
开发者ID:blink1073,项目名称:pyqtgraph,代码行数:7,代码来源:PlotDataItem.py

示例11: __init__

 def __init__(self, *args, **kargs):
     """
     Forwards all arguments to :func:`setData <pyqtgraph.PlotCurveItem.setData>`.
     
     Some extra arguments are accepted as well:
     
     ==============  =======================================================
     **Arguments:**
     parent          The parent GraphicsObject (optional)
     clickable       If True, the item will emit sigClicked when it is 
                     clicked on. Defaults to False.
     ==============  =======================================================
     """
     GraphicsObject.__init__(self, kargs.get('parent', None))
     self.clear()
     self.path = None
     self.fillPath = None
     self._boundsCache = [None, None]
         
     ## this is disastrous for performance.
     #self.setCacheMode(QtGui.QGraphicsItem.DeviceCoordinateCache)
     
     self.metaData = {}
     self.opts = {
         'pen': fn.mkPen('w'),
         'shadowPen': None,
         'fillLevel': None,
         'brush': None,
         'stepMode': False,
         'name': None,
         'antialias': pg.getConfigOption('antialias'),
     }
     self.setClickable(kargs.get('clickable', False))
     self.setData(*args, **kargs)
开发者ID:cycomanic,项目名称:pyqtgraph,代码行数:34,代码来源:PlotCurveItem.py

示例12: __init__

 def __init__(self, **opts):
     """
     Arrows can be initialized with any keyword arguments accepted by 
     the setStyle() method.
     """
     QtGui.QGraphicsPathItem.__init__(self, opts.get('parent', None))
     if 'size' in opts:
         opts['headLen'] = opts['size']
     if 'width' in opts:
         opts['headWidth'] = opts['width']
     defOpts = {
         'pxMode': True,
         'angle': -150,   ## If the angle is 0, the arrow points left
         'pos': (0,0),
         'headLen': 20,
         'tipAngle': 25,
         'baseAngle': 0,
         'tailLen': None,
         'tailWidth': 3,
         'pen': (200,200,200),
         'brush': (50,50,200),
     }
     defOpts.update(opts)
     
     self.setStyle(**defOpts)
     
     self.setPen(fn.mkPen(defOpts['pen']))
     self.setBrush(fn.mkBrush(defOpts['brush']))
     
     self.rotate(self.opts['angle'])
     self.moveBy(*self.opts['pos'])
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:31,代码来源:ArrowItem.py

示例13: setShadowPen

 def setShadowPen(self, *args, **kargs):
     """Set the shadow pen used to draw behind tyhe primary pen.
     This pen must have a larger width than the primary 
     pen to be visible.
     """
     self.opts['shadowPen'] = fn.mkPen(*args, **kargs)
     self.update()
开发者ID:archphy,项目名称:poropy,代码行数:7,代码来源:PlotCurveItem.py

示例14: paint

 def paint(self, p, *args):
     if self.border is None:
         return
     p.setPen(fn.mkPen(self.border))
     for i in self.items:
         r = i.mapRectToParent(i.boundingRect())
         p.drawRect(r)
开发者ID:emayssat,项目名称:sandbox,代码行数:7,代码来源:GraphicsLayout.py

示例15: addItem

    def addItem(self, item, name):
        """
        Add a new entry to the legend.

        ==============  ========================================================
        **Arguments:**
        item            A PlotDataItem from which the line and point style
                        of the item will be determined or an instance of
                        ItemSample (or a subclass), allowing the item display
                        to be customized.
        title           The title to display for this item. Simple HTML allowed.
        ==============  ========================================================
        """

        # get item color
        pen = fn.mkPen(item.opts['pen'])
        color = pen.color()
        color_str = color.name()

        #create label with same color
        label = LabelItem()
        label.setAttr('color', str(color_str[1:]))
        label.setText(name)

        if isinstance(item, ItemSample):
            sample = item
        else:
            sample = ItemSample(item)

        self.legendItems.append((sample, label))
        self.plotItems.append(item)
        self.layout.addItem(sample, self.numItems, 0)
        self.layout.addItem(label, self.numItems, 1)
        self.numItems += 1
        self.updateSize()
开发者ID:kif,项目名称:Py2DeX,代码行数:35,代码来源:ExLegendItem.py


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