2012-08-23 47 views
0

我已经用qt设计器制作了一个gui,并使用pyqt。我添加了一个随python(x,y)包一起提供的matplotlibwidget。如何通过单击GUI上的按钮来显示图形?谢谢!按钮点击pyqt和python(x,y)的显示图matplotlibwidget

+2

你应该尝试添加的你做了什么已经,例如一个例子你如何定义你的数据,你想要什么样的阴谋,应该发生什么等等...... –

回答

0

我希望这将帮助你:

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