0

I have made a gui with qt designer and use pyqt. I added a matplotlibwidget which is provided with the python(x,y) package. How can I display a graph by clicking a button on the GUI? Thanks!

  • 2
    You should try to add an example of what you did already, e.g. how you define your data, what kind of plot you want, what should happen, etc... – Pierre GM Aug 23 '12 at 15:57

1 Answers1

0

I hope this will help you:

class MyClass(QtGui.QMainWindow):
    def __init__(self,parent = None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = PYQTMainWindow.Ui_MainWindow()
        self.ui.setupUi(self)
        ...
        self.connect(self.ui.myButton, QtCore.SIGNAL('clicked()'), self.DisplayGraph)
        #next line will work too:
        #self.ui.myButton.clicked(self.DisplayGraph)

    def DisplayGraph(self):
        #... set your graph here the way you want
Aleksandar
  • 3,541
  • 4
  • 34
  • 57