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


Python ParameterTree.show方法代码示例

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


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

示例1: restore

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import show [as 别名]
    global state
    state = p.saveState()
    
def restore():
    global state
    add = p['Save/Restore functionality', 'Restore State', 'Add missing items']
    rem = p['Save/Restore functionality', 'Restore State', 'Remove extra items']
    p.restoreState(state, addChildren=add, removeChildren=rem)
p.param('Save/Restore functionality', 'Save State').sigActivated.connect(save)
p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(restore)


## Create two ParameterTree widgets, both accessing the same data
t = ParameterTree()
t.setParameters(p, showTop=False)
t.show()
t.resize(400,800)
t2 = ParameterTree()
t2.setParameters(p, showTop=False)
t2.show()
t2.resize(400,800)
    
## test save/restore
s = p.saveState()
p.restoreState(s)


## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
开发者ID:fivejjs,项目名称:pyqtgraph,代码行数:33,代码来源:parametertree.py

示例2: View

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import show [as 别名]
class View(QtGui.QWidget):
    def __init__(self, parent = None, with_config = False, **kargs ):
        QtGui.QWidget.__init__(self, parent)
        
        self.resize(800,600)
        
        mainlayout = QtGui.QVBoxLayout()
        self.setLayout(mainlayout)
        
        self.glview = gl.GLViewWidget()
        mainlayout.addWidget(self.glview)
        self.glview .setCameraPosition(160,160,15)
        
        
        if with_config:
            h = QtGui.QHBoxLayout()
            mainlayout.addLayout(h)
            but =  QtGui.QPushButton('Config', icon = QtGui.QIcon.fromTheme('configure'))
            h.addWidget(but)
            but.clicked.connect(self.open_params)
            but =  QtGui.QPushButton('Save png', icon = QtGui.QIcon.fromTheme('save'))
            h.addWidget(but)
            but.clicked.connect(self.open_save_dialog)
            
        
        
        _params = [
                {'name': 'cortical_mesh', 'type': 'list', 'values': cortical_meshes.keys(), 'value' :  'BrainMesh_ICBM152'},
                {'name': 'cortical_alpha', 'type': 'float', 'value': .1, 'limits': [0., 1.], 'step' : .01},
                {'name': 'cortical_color', 'type': 'color', 'value':  'w'},
                {'name': 'background_color', 'type': 'color', 'value':  'k'},
            ]
        self.params = Parameter.create(name='params', type='group', children=_params)
        self.tree = ParameterTree(parent = self)
        self.tree.setParameters(self.params)
        self.tree.setWindowFlags(QtCore.Qt.Dialog)
        
        
        
        self.mesh = None
        for k,v in kargs.items():
            self.params[k] = v
        self.change_background_color()
        self.plot_mesh()
        self.change_color_mesh()

        self.params.param('cortical_mesh').sigValueChanged.connect(self.plot_mesh)
        self.params.param('cortical_alpha').sigValueChanged.connect(self.change_color_mesh)
        self.params.param('cortical_color').sigValueChanged.connect(self.change_color_mesh)
        self.params.param('background_color').sigValueChanged.connect(self.change_background_color)

        self.glview.resizeGL(self.glview.width(), self.glview.height())

    def open_params(self):
        self.tree.show()
    
    def change_background_color(self):
        background_color =  self.params['background_color']
        try:
            self.glview.setBackgroundColor(background_color)
        except:
            #~ #FIXME this is buggy in pyqtgrap0.9.8
            bgcolor = pg.mkColor(QtGui.QColor(background_color))
            glClearColor(bgcolor.red()/255., bgcolor.green()/255., bgcolor.blue()/255., 1.0)
            glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT )
            self.glview.paintGL()
            self.glview.update()
    
    
    def plot_mesh(self):
        vertexes, faces = cortical_meshes[self.params['cortical_mesh']]
        alpha =  self.params['cortical_alpha']
        c = self.params['cortical_color']
        color = (c.red()/255., c.green()/255.,c.blue()/255.,alpha)
        
        if self.mesh is None:
            
            self.mesh = gl.GLMeshItem(vertexes=vertexes, faces=faces, smooth=True, drawFaces=True,
                                                    drawEdges=False,
                                                    edgeColor=(1.,1.,1.,.2), 
                                                    color = color,
                                                    computeNormals = False,
                                                    glOptions='translucent',
                                                    #~ shader='balloon',
                                                    shader='shaded', 
                                                    )
            self.glview.addItem(self.mesh)
        else:
            self.mesh.setMeshData(vertexes=vertexes, faces=faces)
            #~ self.mesh.set
            
    
    def change_color_mesh(self):
        alpha =  self.params['cortical_alpha']
        c = self.params['cortical_color']
        color = (c.red()/255., c.green()/255.,c.blue()/255.,alpha)
        self.mesh.setColor(color)
    
    def add_node(self, coords, color = (1,1,1,0), size = 5):
        sp1 = gl.GLScatterPlotItem(pos=coords, size=size, color=color, pxMode=False)
#.........这里部分代码省略.........
开发者ID:davidmeunier79,项目名称:pyplotbrain,代码行数:103,代码来源:view.py

示例3: SpectrumViewer

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import show [as 别名]

#.........这里部分代码省略.........
            spectrum.addAction(self.addspectrumAction)
            spectrum.addAction(self.removespectrumAction)

        def initParameterTree(self):
            '''The sidebar.'''
            self.parametertree = ParameterTree()
            self.params = []

        def initUI(self):
            '''Initializes the main window widgets.'''
            self.initToolBar()
            self.initMenuBar()
            self.initParameterTree()

            self.plotwidget = pg.PlotWidget()
            self.plot = self.plotwidget.plotItem
            self.plot.setMenuEnabled(False)
            #cross hair
            self.vLine = pg.InfiniteLine(angle=90, movable=False)
            self.hLine = pg.InfiniteLine(angle=0, movable=False)
            self.plotwidget.addItem(self.vLine, ignoreBounds=True)
            self.plotwidget.addItem(self.hLine, ignoreBounds=True)
            self.vb = self.plot.vb
            self.plot.scene().sigMouseMoved.connect(self.mouseMoved)

            widget = QtGui.QWidget()
            hbox = QtGui.QHBoxLayout(widget)
            hbox.addWidget(self.parametertree)
            hbox.addWidget(self.plotwidget, 1)

            self.setCentralWidget(widget)
            self.resize(1200, 600)
            self.setWindowTitle('Molviewer :: Spectrum main window')
            self.show()

        def mouseMoved(self, evt):
            '''Detect mouse movement.'''
            pos = evt
            if self.plot.sceneBoundingRect().contains(pos):
                mousePoint = self.vb.mapSceneToView(pos)
                self.vLine.setPos(mousePoint.x())
                self.hLine.setPos(mousePoint.y())

        def new(self):
            '''Spawn new main window.'''
            spawn = SpectrumViewer(self)
            spawn.setWindowTitle('Molviewer :: Spectrum main window (child)')
            spawn.show()

        def open(self):
            '''Open a new spectrum using the file dialog.'''
            filenames = QtGui.QFileDialog.getOpenFileNames(self, 'Open Files', '', '*.dx;; *.jdx')
            if filenames:
                for f in filenames:
                    spectrum = Spectrum(f)
                    self.addspectrum(spectrum)

        def save(self):
            pass

        def saveimage(self):
            pass

        def draw(self, spectrum):
            '''Draw a new spectrum.
开发者ID:andrekorte,项目名称:molviewer,代码行数:69,代码来源:spectrumviewer.py

示例4: ParameterTree

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import show [as 别名]
          plotList[0].setTitle(msg)
        if childName=='secondCh':
          print "data: ", data
          chB = p.param('secondCh').value()
          msg = "Ch%dCh%d" % (chA, chB)
          plotList[0].setTitle(msg)
                    

p.param('Reset Histogram').sigActivated.connect(resetHist)
p.param('Save Histogram').sigActivated.connect(saveHist)
p.param('Save Figure').sigActivated.connect(saveFig)

p.sigTreeStateChanged.connect(change)
t = ParameterTree()
t.setParameters(p, showTop = False)
t.show()  


chA = p.param('firstCh').value()
chB = p.param('secondCh').value()
if True:
  win = pg.GraphicsWindow()
  win.resize(1600,600)
  win.setWindowTitle('Real Time Histogram')
  plotList = []
  for i in range(p.param('numPlots').value()):
    if i == 3:
      plt = win.addPlot(labels = {'left': 'log10(Counts)', 'bottom': 'time'}, title = "Ch%dCh%d" %(chA,chB))
      plotList.append(plt)
      win.nextRow()
    else:
开发者ID:mallman777,项目名称:ttag,代码行数:33,代码来源:RTHist4.py


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