• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python functions.mkBrush函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __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


示例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: process

 def process(self, In):
     kwargs = self.CW().prepareInputArguments()
     if kwargs['closed']:
         self.graphicsItem().setBrush(fn.mkBrush(self.closed_color))
         return {'Out': None}
     else:
         self.graphicsItem().setBrush(fn.mkBrush(self.opened_color))
         return {'Out': In}
开发者ID:cdd1969,项目名称:pygwa,代码行数:8,代码来源:node_pipe.py


示例4: paintEvent

 def paintEvent(self, ev):
     QtGui.QPushButton.paintEvent(self, ev)
     p = QtGui.QPainter(self)
     rect = self.rect().adjusted(6, 6, -6, -6)
     ## draw white base, then texture for indicating transparency, then actual color
     p.setBrush(functions.mkBrush('w'))
     p.drawRect(rect)
     p.setBrush(QtGui.QBrush(QtCore.Qt.DiagCrossPattern))
     p.drawRect(rect)
     p.setBrush(functions.mkBrush(self._color))
     p.drawRect(rect)
     p.end()
开发者ID:calanoue,项目名称:pyqtgraph,代码行数:12,代码来源:ColorButton.py


示例5: __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


示例6: setSymbolBrush

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


示例7: updateBackground

 def updateBackground(self):
     bg = self.state['background']
     if bg is None:
         self.background.hide()
     else:
         self.background.show()
         self.background.setBrush(fn.mkBrush(bg))
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:7,代码来源:ViewBox.py


示例8: hoverEvent

 def hoverEvent(self, ev):
     if not ev.isExit() and ev.acceptDrags(QtCore.Qt.LeftButton):
         ev.acceptClicks(QtCore.Qt.LeftButton) ## we don't use the click, but we also don't want anyone else to use it.
         self.box.setBrush(fn.mkBrush('w'))
     else:
         self.box.setBrush(self.brush)
     self.update()
开发者ID:emayssat,项目名称:sandbox,代码行数:7,代码来源:Terminal.py


示例9: __init__

 def __init__(self, parent=None, useOpenGL=None, background='k'):
     """Re-implementation of QGraphicsView that removes scrollbars and allows unambiguous control of the 
     viewed coordinate range. Also automatically creates a QGraphicsScene and a central QGraphicsWidget
     that is automatically scaled to the full view geometry.
     
     By default, the view coordinate system matches the widget's pixel coordinates and 
     automatically updates when the view is resized. This can be overridden by setting 
     autoPixelRange=False. The exact visible range can be set with setRange().
     
     The view can be panned using the middle mouse button and scaled using the right mouse button if
     enabled via enableMouse()  (but ordinarily, we use ViewBox for this functionality)."""
     self.closed = False
     
     QtGui.QGraphicsView.__init__(self, parent)
     
     if useOpenGL is None:
         useOpenGL = pyqtgraph.getConfigOption('useOpenGL')
     
     self.useOpenGL(useOpenGL)
     
     self.setCacheMode(self.CacheBackground)
     
     if background is not None:
         brush = fn.mkBrush(background)
         self.setBackgroundBrush(brush)
     
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.setFrameShape(QtGui.QFrame.NoFrame)
     self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     self.setTransformationAnchor(QtGui.QGraphicsView.NoAnchor)
     self.setResizeAnchor(QtGui.QGraphicsView.AnchorViewCenter)
     self.setViewportUpdateMode(QtGui.QGraphicsView.MinimalViewportUpdate)
     
     
     #self.setSceneRect(QtCore.QRectF(-1e10, -1e10, 2e10, 2e10))
     
     self.lockedViewports = []
     self.lastMousePos = None
     self.setMouseTracking(True)
     self.aspectLocked = False
     #self.yInverted = True
     self.range = QtCore.QRectF(0, 0, 1, 1)
     self.autoPixelRange = True
     self.currentItem = None
     self.clearMouse()
     self.updateMatrix()
     self.sceneObj = GraphicsScene()
     self.setScene(self.sceneObj)
     
     ## by default we set up a central widget with a grid layout.
     ## this can be replaced if needed.
     self.centralWidget = None
     self.setCentralItem(QtGui.QGraphicsWidget())
     self.centralLayout = QtGui.QGraphicsGridLayout()
     self.centralWidget.setLayout(self.centralLayout)
     
     self.mouseEnabled = False
     self.scaleCenter = False  ## should scaling center around view center (True) or mouse click (False)
     self.clickAccepted = False
开发者ID:calanoue,项目名称:pyqtgraph,代码行数:60,代码来源:GraphicsView.py


示例10: __init__

 def __init__(self, size, width=5, color=(100, 100, 255)):
     UIGraphicsItem.__init__(self)
     self.setAcceptedMouseButtons(QtCore.Qt.NoButton)
     
     self.brush = fn.mkBrush(color)
     self.pen = fn.mkPen((0,0,0))
     self._width = width
     self.size = size
开发者ID:cycomanic,项目名称:pyqtgraph,代码行数:8,代码来源:ScaleBar.py


示例11: buildAtlas

    def buildAtlas(self):
        # get rendered array for all symbols, keep track of avg/max width
        rendered = {}
        avgWidth = 0.0
        maxWidth = 0
        images = []
        for key, coords in self.symbolMap.items():
            if len(coords) == 0:
                pen = fn.mkPen(color=key[2], width=key[3], style=key[4])
                brush = fn.mkBrush(color=key[5])
                img = renderSymbol(key[0], key[1], pen, brush)
                images.append(img)  ## we only need this to prevent the images being garbage collected immediately
                arr = fn.imageToArray(img, copy=False, transpose=False)
            else:
                (x,y,w,h) = self.symbolMap[key]
                arr = self.atlasData[x:x+w, y:y+w]
            rendered[key] = arr
            w = arr.shape[0]
            avgWidth += w
            maxWidth = max(maxWidth, w)
            
        nSymbols = len(rendered)
        if nSymbols > 0:
            avgWidth /= nSymbols
            width = max(maxWidth, avgWidth * (nSymbols**0.5))
        else:
            avgWidth = 0
            width = 0
        
        # sort symbols by height
        symbols = sorted(rendered.keys(), key=lambda x: rendered[x].shape[1], reverse=True)
        
        self.atlasRows = []

        x = width
        y = 0
        rowheight = 0
        for key in symbols:
            arr = rendered[key]
            w,h = arr.shape[:2]
            if x+w > width:
                y += rowheight
                x = 0
                rowheight = h
                self.atlasRows.append([y, rowheight, 0])
            self.symbolMap[key][:] = x, y, w, h
            x += w
            self.atlasRows[-1][2] = x
        height = y + rowheight

        self.atlasData = np.zeros((width, height, 4), dtype=np.ubyte)
        for key in symbols:
            x, y, w, h = self.symbolMap[key]
            self.atlasData[x:x+w, y:y+h] = rendered[key]
        self.atlas = None
        self.atlasValid = True
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:56,代码来源:ScatterPlotItem.py


示例12: setBackground

 def setBackground(self, background):
     """
     Set the background color of the GraphicsView.
     To use the defaults specified py pyqtgraph.setConfigOption, use background='default'.
     To make the background transparent, use background=None.
     """
     self._background = background
     if background == 'default':
         background = pyqtgraph.getConfigOption('background')
     brush = fn.mkBrush(background)
     self.setBackgroundBrush(brush)
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:11,代码来源:GraphicsView.py


示例13: __init__

    def __init__(self, name, parent=None):
        terms = {'coord': {'io': 'in'},
                 'data': {'io': 'in'},
                 'this': {'io': 'out'},
                 'All': {'io': 'out'}}
        super(hydraulicGradientNode, self).__init__(name, terminals=terms)
        self.graphicsItem().setBrush(fn.mkBrush(250, 250, 150, 150))

        self._ctrlWidget = hydraulicGradientNodeCtrlWidget(self)

        self._coords_id = None
开发者ID:cdd1969,项目名称:pygwa,代码行数:11,代码来源:node_hydrgrad.py


示例14: __init__

    def __init__(self, name, color=(200, 200, 200, 150), ui=None, parent=None, **kwargs):
        self._parent = parent
        kwargs['terminals'] = kwargs.get('terminals', {'In': {'io': 'in'}, 'Out': {'io': 'out'}})
        super(NodeWithCtrlWidget, self).__init__(name, **kwargs)
        logger.debug("about to create node [{0}] of type [{1}]".format(self.name(), self.nodeName))
        self._init_at_first()
        self.graphicsItem().setBrush(fn.mkBrush(color))

        if ui is None:
            ui = getattr(self, 'uiTemplate', [])
        self._ctrlWidget = self._createCtrlWidget(parent=self, ui=ui)
        logger.info("node [{0}] of type [{1}] created".format(self.name(), self.nodeName))
开发者ID:cdd1969,项目名称:pygwa,代码行数:12,代码来源:generalNode.py


示例15: __init__

    def __init__(self, name, parent=None):
        super(QuickViewNode, self).__init__(name, terminals={'In': {'io': 'in'}})
        self.graphicsItem().setBrush(fn.mkBrush(150, 150, 250, 200))
        self._pandasDataModel   = PandasDataModel(parent=self)
        self._pandasHeaderModel = PandasHeaderModel(parent=self)
        self._ctrlWidget = QuickViewCtrlWidget(self)

        # connect show/hide signals
        self._pandasHeaderModel.row_hidden.connect(self._ctrlWidget.tableView.horizontalHeader().hideSection)  #argumnent [int]
        self._pandasHeaderModel.row_showed.connect(self._ctrlWidget.tableView.horizontalHeader().showSection)  #argumnent [int]
        self._pandasDataModel.modelReset.connect(self._ctrlWidget.update)  #no argument


        self._id = None
开发者ID:cdd1969,项目名称:pygwa,代码行数:14,代码来源:node_quickview.py


示例16: setBackground

 def setBackground(self, background):
     """
     Set the background color of the GraphicsView.
     To use the defaults specified py pyqtgraph.setConfigOption, use background='default'.
     To make the background transparent, use background=None.
     """
     self._background = background
     if background == "default":
         background = pyqtgraph.getConfigOption("background")
     if background is None:
         self.setBackgroundRole(QtGui.QPalette.NoRole)
     else:
         brush = fn.mkBrush(background)
         self.setBackgroundBrush(brush)
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:14,代码来源:GraphicsView.py


示例17: plot_complex_event

    def plot_complex_event(self, complex_event, line_color=None,
                           brush_color=None,with_text=True):
        '''Plots a single event'''
        name = complex_event['name']
        start = complex_event['start'] / self.scaling_factor
        stop = complex_event['stop'] / self.scaling_factor
        region = labelRegion(name, start, stop, parent=self)

        if line_color is not None:
            for line,color in zip(region.lines,line_color):
                line.setPen(fn.mkPen(color))
        if brush_color is not None:
            region.setBrush(fn.mkBrush(brush_color))
        
        return region
开发者ID:gfetterman,项目名称:arfview,代码行数:15,代码来源:labelPlot.py


示例18: paint

    def paint(self, p, *args):
        #p.setRenderHint(p.Antialiasing)  # only if the data is antialiased.
        opts = self.item.opts

        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 not isinstance(self.item, ScatterPlotItem):
            p.setPen(fn.mkPen(opts['pen']))
            p.drawLine(2, 10, 18, 10)

        symbol = opts.get('symbol', None)
        if symbol is not None:
            if isinstance(self.item, PlotDataItem):
                opts = self.item.scatter.opts

            pen = fn.mkPen(opts['pen'])
            brush = fn.mkBrush(opts['brush'])
            size = opts['size']

            p.translate(10,10)
            path = drawSymbol(p, symbol, size, pen, brush)
开发者ID:rkoyama1623,项目名称:log-plotter,代码行数:24,代码来源:pyqtgraph_LegendItem_patch.py


示例19: getSpotOpts

 def getSpotOpts(self, recs, scale=1.0):
     if recs.ndim == 0:
         rec = recs
         symbol = rec['symbol']
         if symbol is None:
             symbol = self.opts['symbol']
         size = rec['size']
         if size < 0:
             size = self.opts['size']
         pen = rec['pen']
         if pen is None:
             pen = self.opts['pen']
         brush = rec['brush']
         if brush is None:
             brush = self.opts['brush']
         return (symbol, size*scale, fn.mkPen(pen), fn.mkBrush(brush))
     else:
         recs = recs.copy()
         recs['symbol'][np.equal(recs['symbol'], None)] = self.opts['symbol']
         recs['size'][np.equal(recs['size'], -1)] = self.opts['size']
         recs['size'] *= scale
         recs['pen'][np.equal(recs['pen'], None)] = fn.mkPen(self.opts['pen'])
         recs['brush'][np.equal(recs['brush'], None)] = fn.mkBrush(self.opts['brush'])
         return recs
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:24,代码来源:ScatterPlotItem.py


示例20: __init__

 def __init__(self, term, parent=None):
     self.term = term
     #QtGui.QGraphicsItem.__init__(self, parent)
     GraphicsObject.__init__(self, parent)
     self.brush = fn.mkBrush(0,0,0)
     self.box = QtGui.QGraphicsRectItem(0, 0, 10, 10, self)
     self.label = QtGui.QGraphicsTextItem(self.term.name(), self)
     self.label.scale(0.7, 0.7)
     #self.setAcceptHoverEvents(True)
     self.newConnection = None
     self.setFiltersChildEvents(True)  ## to pick up mouse events on the rectitem
     if self.term.isRenamable():
         self.label.setTextInteractionFlags(QtCore.Qt.TextEditorInteraction)
         self.label.focusOutEvent = self.labelFocusOut
         self.label.keyPressEvent = self.labelKeyPress
     self.setZValue(1)
     self.menu = None
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:17,代码来源:Terminal.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python functions.mkPen函数代码示例发布时间:2022-05-27
下一篇:
Python common.CtrlNode类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap