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


Python pyqtgraph.mkBrush方法代码示例

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


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

示例1: generatePicture

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def generatePicture(self):
            ## pre-computing a QPicture object allows paint() to run much more quickly,
            ## rather than re-drawing the shapes every time.
            self.picture = QtGui.QPicture()
            p = QtGui.QPainter(self.picture)
            p.setPen(pg.mkPen(color='w', width=0.4))  # 0.4 means w*2
            a = pg.AxisItem('bottom', pen=None, linkView=None, parent=None, maxTickLength=-5, showValues=True)
            a.setFixedWidth(1)
            a.setWidth(1)
            a.setLabel(show=True)
            a.setGrid(grid=True)
            labelStyle = {'color': '#FFF', 'font-size': '14pt'}
            a.setLabel('label text', units='V', **labelStyle)
            # w = (self.data[1][0] - self.data[0][0]) / 3.
            w = 0.2
            for (t, open, close, min, max) in self.data:
                p.drawLine(QtCore.QPointF(t, min), QtCore.QPointF(t, max))
                if open > close:
                    p.setBrush(pg.mkBrush('g'))
                else:
                    p.setBrush(pg.mkBrush('r'))
                p.drawRect(QtCore.QRectF(t-w, open, w*2, close-open))
                pg.setConfigOption('leftButtonPan', False)
            p.end() 
开发者ID:sunshinelover,项目名称:chanlun,代码行数:26,代码来源:uiChanlunWidget.py

示例2: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, manager: BarManager):
        """"""
        super().__init__()

        self._manager: BarManager = manager

        self._bar_picutures: Dict[int, QtGui.QPicture] = {}
        self._item_picuture: QtGui.QPicture = None

        self._up_pen: QtGui.QPen = pg.mkPen(
            color=UP_COLOR, width=PEN_WIDTH
        )
        self._up_brush: QtGui.QBrush = pg.mkBrush(color=UP_COLOR)

        self._down_pen: QtGui.QPen = pg.mkPen(
            color=DOWN_COLOR, width=PEN_WIDTH
        )
        self._down_brush: QtGui.QBrush = pg.mkBrush(color=DOWN_COLOR)

        self._rect_area: Tuple[float, float] = None

        # Very important! Only redraw the visible part and improve speed a lot.
        self.setFlag(self.ItemUsesExtendedStyleOption) 
开发者ID:nicai0609,项目名称:Python-CTPAPI,代码行数:25,代码来源:candle_demo.py

示例3: generatePicture

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def generatePicture(self):
            ## pre-computing a QPicture object allows paint() to run much more quickly,
            ## rather than re-drawing the shapes every time.
            self.picture = QtGui.QPicture()
            p = QtGui.QPainter(self.picture)
            p.setPen(pg.mkPen(color='w', width=0.4))  # 0.4 means w*2
            # w = (self.data[1][0] - self.data[0][0]) / 3.
            w = 0.2
            for (t, open, close, min, max) in self.data:
                p.drawLine(QtCore.QPointF(t, min), QtCore.QPointF(t, max))
                if open > close:
                    p.setBrush(pg.mkBrush('g'))
                else:
                    p.setBrush(pg.mkBrush('r'))
                p.drawRect(QtCore.QRectF(t-w, open, w*2, close-open))
            p.end() 
开发者ID:sunshinelover,项目名称:chanlun,代码行数:18,代码来源:demoUi.py

示例4: generatePicture

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def generatePicture(self):
            ## pre-computing a QPicture object allows paint() to run much more quickly,
            ## rather than re-drawing the shapes every time.
            self.picture = QtGui.QPicture()
            p = QtGui.QPainter(self.picture)
            p.setPen(pg.mkPen(color='r', width=0.4))  # 0.4 means w*2
            # w = (self.data[1][0] - self.data[0][0]) / 3.
            w = 0.2
            for (t, open, close, min, max) in self.data:
                p.drawLine(QtCore.QPointF(t, min), QtCore.QPointF(t, max))
                if open > close:
                    p.setBrush(pg.mkBrush('g'))
                else:
                    p.setBrush(pg.mkBrush('r'))
                p.drawRect(QtCore.QRectF(t-w, open, w*2, close-open))
            p.end() 
开发者ID:zhengwsh,项目名称:InplusTrader_Linux,代码行数:18,代码来源:uiBasicWidget.py

示例5: cell_chosen

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def cell_chosen(self):
        if self.Floaded:
            self.cell_mask()
            self.ROIedit.setText(str(self.ichosen))
            rgb = np.array(self.colors[self.ichosen])
            self.cellscatter.setData(self.xext, self.yext,
                                     pen=pg.mkPen(list(rgb)),
                                     brush=pg.mkBrush(list(rgb)), size=3)
            self.cellscatter_side.setData(self.xext, self.yext,
                                     pen=pg.mkPen(list(rgb)),
                                     brush=pg.mkBrush(list(rgb)), size=3)

            if self.ichosen >= len(self.stat):
                self.ichosen = len(self.stat) - 1
            self.cell_mask()
            self.ft = self.Fcell[self.ichosen,:]
            self.plot_trace()
            self.p2.setXLink('plot_shift')
            self.jump_to_frame()
            self.show() 
开发者ID:MouseLand,项目名称:suite2p,代码行数:22,代码来源:reggui.py

示例6: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, winsize=10, **kwargs):
        # type: (int) -> None
        """
        Args:
            winsize (int): number of trials in the past to take a rolling mean of
        """
        super(Roll_Mean, self).__init__()

        self.winsize = winsize

        self.setFillLevel(0.5)

        self.series = pd.Series()

        self.brush = pg.mkBrush((0,0,0,100))
        self.setBrush(self.brush) 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:18,代码来源:plots.py

示例7: generate_picture

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def generate_picture(self, boundingRect):
        w = self.candle_width
        w2 = w * 0.5
        left,right = boundingRect.left(), boundingRect.right()
        p = self.painter
        p.begin(self.picture)
        df,origlen = self.datasrc.rows(5, left, right, yscale=self.ax.vb.yscale)
        drawing_many_shadows = self.draw_shadow and origlen > lod_candles*2//3
        for shadow,frame,body,df_rows in self.colorfunc(self, self.datasrc, df):
            idxs = df_rows.index
            rows = df_rows.values
            if self.x_offset:
                idxs += self.x_offset
            if self.draw_shadow:
                p.setPen(pg.mkPen(shadow))
                for x,(t,open,close,high,low) in zip(idxs, rows):
                    if high > low:
                        p.drawLine(QtCore.QPointF(x, low), QtCore.QPointF(x, high))
            if self.draw_body and not drawing_many_shadows: # settle with only drawing shadows if too much detail
                p.setPen(pg.mkPen(frame))
                p.setBrush(pg.mkBrush(body))
                for x,(t,open,close,high,low) in zip(idxs, rows):
                    p.drawRect(QtCore.QRectF(x-w2, open, w, close-open))
        p.end() 
开发者ID:highfestiva,项目名称:finplot,代码行数:26,代码来源:__init__.py

示例8: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, parent=None):
        pyqtgraph.setConfigOption('background', 'w') #before loading widget
        super(ExampleApp, self).__init__(parent)
        self.setupUi(self)
        self.grECG.plotItem.showGrid(True, True, 0.7)
        self.btnSave.clicked.connect(self.saveFig)
        self.btnSite.clicked.connect(self.website)
        stamp="DIY ECG by Scott Harden"
        self.stamp = pyqtgraph.TextItem(stamp,anchor=(-.01,1),color=(150,150,150),
                                        fill=pyqtgraph.mkBrush('w'))
        self.ear = swhear.Ear(chunk=int(100)) # determines refresh rate
        # optionally you can manually set the audio input device to use like this:
        # self.ear = swhear.Ear(chunk=int(100), device=5) # use audio input device 5
        if len(self.ear.valid_input_devices()):
            self.ear.stream_start()
            self.lblDevice.setText(self.ear.msg)
            self.update() 
开发者ID:swharden,项目名称:diyECG-1opAmp,代码行数:19,代码来源:go.py

示例9: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, data):
        """初始化"""
        pg.GraphicsObject.__init__(self)
        # 数据格式: [ (time, open, close, low, high),...]
        self.data = data
        # 只重画部分图形,大大提高界面更新速度
        self.rect = None
        self.picture = None
        self.setFlag(self.ItemUsesExtendedStyleOption)
        # 画笔和画刷
        w = 0.4
        self.offset   = 0
        self.low      = 0
        self.high     = 1
        self.picture  = QtGui.QPicture()
        self.pictures = []
        self.gPen     = pg.mkPen(color=(1, 255, 7, 255), width=w*2)
        self.gBrush   = pg.mkBrush((1, 255, 7, 255))
        self.bPen     = pg.mkPen(color=(0, 240, 240, 255), width=w*2)
        self.bBrush   = pg.mkBrush((0, 240, 240, 255))
        self.rPen     = pg.mkPen(color=(255, 60, 60, 255), width=w*2)
        self.rBrush   = pg.mkBrush((255, 60, 60, 255))
        self.rBrush.setStyle(Qt.NoBrush)
        # 刷新K线
        self.generatePicture(self.data)          


    # 画K线
    #---------------------------------------------------------------------- 
开发者ID:rjj510,项目名称:uiKLine,代码行数:31,代码来源:uiKLine.py

示例10: makeGraph

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def makeGraph(self):
        #g1 = pg.GraphItem(pos=self.pos, adj=self.links[self.rope], pen=0.2, symbol=None)
        brushes = np.where(self.fixed, pg.mkBrush(0,0,0,255), pg.mkBrush(50,50,200,255))
        g2 = pg.GraphItem(pos=self.pos, adj=self.links[self.push & self.pull], pen=0.5, brush=brushes, symbol='o', size=(self.mass**0.33), pxMode=False)
        p = pg.ItemGroup()
        #p.addItem(g1)
        p.addItem(g2)
        return p 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:10,代码来源:chain.py

示例11: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, pen=None, brush=None, **opts):
        """
        Arguments for each surface are:
           x1,x2 - position of center of _physical surface_
           r1,r2 - radius of curvature
           d1,d2 - diameter of optic
        """
        defaults = dict(x1=-2, r1=100, d1=25.4, x2=2, r2=100, d2=25.4)
        defaults.update(opts)
        ParamObj.__init__(self)
        self.surfaces = [CircleSurface(defaults['r1'], defaults['d1']), CircleSurface(-defaults['r2'], defaults['d2'])]
        pg.GraphicsObject.__init__(self)
        for s in self.surfaces:
            s.setParentItem(self)
        
        if pen is None:
            self.pen = pg.mkPen((220,220,255,200), width=1, cosmetic=True)
        else:
            self.pen = pg.mkPen(pen)
        
        if brush is None: 
            self.brush = pg.mkBrush((230, 230, 255, 30))
        else:
            self.brush = pg.mkBrush(brush)

        self.setParams(**defaults) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:28,代码来源:pyoptic.py

示例12: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, x0=0.0, y0=0.0, m0=1.0, v0=0.0, t0=0.0, color=None, prog=None, size=0.5):
        Clock.nClocks += 1
        self.pen = pg.mkPen(color)
        self.brush = pg.mkBrush(color)
        self.y0 = y0
        self.x0 = x0
        self.v0 = v0
        self.m0 = m0
        self.t0 = t0
        self.prog = prog
        self.size = size 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:13,代码来源:relativity.py

示例13: test_init_spots

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def test_init_spots():
    plot = pg.PlotWidget()
    # set view range equal to its bounding rect.
    # This causes plots to look the same regardless of pxMode.
    plot.setRange(rect=plot.boundingRect())
    spots = [
        {'x': 0, 'y': 1},
        {'pos': (1, 2), 'pen': None, 'brush': None, 'data': 'zzz'},
    ]
    s = pg.ScatterPlotItem(spots=spots)

    # Check we can display without errors
    plot.addItem(s)
    app.processEvents()
    plot.clear()

    # check data is correct
    spots = s.points()

    defPen = pg.mkPen(pg.getConfigOption('foreground'))

    assert spots[0].pos().x() == 0
    assert spots[0].pos().y() == 1
    assert spots[0].pen() == defPen
    assert spots[0].data() is None

    assert spots[1].pos().x() == 1
    assert spots[1].pos().y() == 2
    assert spots[1].pen() == pg.mkPen(None)
    assert spots[1].brush() == pg.mkBrush(None)
    assert spots[1].data() == 'zzz' 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:33,代码来源:test_ScatterPlotItem.py

示例14: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def __init__(self, values, label_section, color):
        pg.LinearRegionItem.__init__(self, values=values, movable=False)

        for line in self.lines:
            line.setPen(pg.mkPen(None))
        self.setBrush(pg.mkBrush(color))
        self.label = label_section

        # signals
        self.item_initialized.emit(self) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:12,代码来源:waveformwidget.py

示例15: mouseDoubleClickEvent

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkBrush [as 别名]
def mouseDoubleClickEvent(self, event):
        
        if not self.element.is_tuneable:
            return

        brush = pg.mkBrush(self.color)
        pg.QtGui.QGraphicsRectItem.setBrush(self, brush)
        
        self.add_tune_block(self.element) 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:11,代码来源:calc_lattice_element_pics.py


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