Python 如何传输为小部件GraphicsViewPlot(小部件)绘制的图形?蟒蛇
我正在尝试将我的senoide图转移到widget graphcsView,但我无法将该图与widget关联。我使用QT设计制作GUI,并使用pyuic生成代码。我可以绘制图形,但不能将视图图形的输入框插入GUI。 拜托,有人能帮我吗Python 如何传输为小部件GraphicsViewPlot(小部件)绘制的图形?蟒蛇,python,graph,qt4,plot,pyqt4,Python,Graph,Qt4,Plot,Pyqt4,我正在尝试将我的senoide图转移到widget graphcsView,但我无法将该图与widget关联。我使用QT设计制作GUI,并使用pyuic生成代码。我可以绘制图形,但不能将视图图形的输入框插入GUI。 拜托,有人能帮我吗 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'plot.ui' # # Created: Thu Aug 30 13:42:21 2012 #
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'plot.ui'
#
# Created: Thu Aug 30 13:42:21 2012
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from pylab import*
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_ploting(object):
def setupUi(self, ploting):
ploting.setObjectName(_fromUtf8("ploting"))
ploting.resize(400, 300)
ploting.setWindowTitle(QtGui.QApplication.translate("ploting", "Ploting", None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonPlot = QtGui.QPushButton(ploting)
self.pushButtonPlot.setGeometry(QtCore.QRect(10, 40, 75, 23))
self.pushButtonPlot.setText(QtGui.QApplication.translate("ploting", "Plot", None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonPlot.setObjectName(_fromUtf8("pushButtonPlot"))
self.graphicsViewPloted = QtGui.QGraphicsView(ploting)
self.graphicsViewPloted.setGeometry(QtCore.QRect(120, 30, 271, 251))
self.graphicsViewPloted.setObjectName(_fromUtf8("graphicsViewPloted"))
self.retranslateUi(ploting)
QtCore.QObject.connect(self.pushButtonPlot, QtCore.SIGNAL(_fromUtf8("clicked()")), self.ploting)
QtCore.QMetaObject.connectSlotsByName(plot_1)
def plot_1(self):
x=arange(0,2,0.01)
y=2*sin(2*pi*(x-1/4))
plot(x,y)
show()
def retranslateUi(self, ploting):
pass
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
ploting = QtGui.QWidget()
ui = Ui_ploting()
ui.setupUi(ploting)
ploting.show()
sys.exit(app.exec_())