Link button to a function

26 views
Skip to first unread message

Simone Olivetti

unread,
Jun 4, 2016, 6:42:20 PM6/4/16
to pyqtgraph
Hello,

I have a piece of code that generates an input panel (see below). I would like to link the button "Plot" to the function plotVect (see text in green), I am not sure  how to do it, any idea?
Sorry for the trivial question, I am quite new to Pyqt.

class VectorComp(pTypes.GroupParameter):
    def __init__(self, **kwds):

        defs = dict(name="Vector", autoIncrementName=True, renamable=True, removable=True, children=[
            dict(name='Plot', type='action'),
            dict(name='X component', type='float', value=2.0, step=0.1),
            dict(name='Y component', type='float', value=2.0, step=0.1),
            dict(name='Z component', type='float', value=2.0),
            dict(name='Color', type='color', value=(100,100,150)),

            ])
              
        pTypes.GroupParameter.__init__(self, **defs)
        self.restoreState(kwds, removeChildren=False)
   

    def plotVect(self):

        print 'OK1'
           
    def buildClocks(self):
        x0 = self['X component']
        color = self['Color']
        m = self['Y component']
        size = self['Z component']
        prog = None#self.param('Acceleration').generate()
        c = Clock(x0=x0, m0=m, color=color, prog=prog, size=size)
        return {self.name(): c}
       
    def clockNames(self):
        return [self.name()]

pTypes.registerParameterType('Vector', VectorComp)


Thank you very much !!
Reply all
Reply to author
Forward
0 new messages