<div dir="ltr"><div><div>Hi <br><br></div><div>I have installed vtk, at, pyqt, python vtk using below commands.<br><br><pre>sudo apt-get install libvtk5.8-qt4 libvtk5-qt4-dev libvtk5-dev libvtk5.8 python-qt4 python-vtk qt4-designer pyqt4-dev-tools<br> python-qt4-gl libqt4-opengl libqt4-assistant<br></pre><br></div>I have a following program. The sample.py is generated from sample.ui (which is desinged using qt4designer) using pyuic4 command. <br><br></div>=================sample.py===============<br><br>from PyQt4 import QtCore, QtGui<br>from vtk.qt4 import *<br>from vtk.qt4.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor<br>from vtk import *<br><br>try:<br> _fromUtf8 = QtCore.QString.fromUtf8<br>except AttributeError:<br> _fromUtf8 = lambda s: s<br><br>class Ui_MainWindow(object):<br> def setupUi(self, MainWindow):<br> MainWindow.setObjectName(_fromUtf8("MainWindow"))<br> MainWindow.resize(626, 320)<br> self.centralwidget = QtGui.QWidget(MainWindow)<br> self.centralwidget.setObjectName(_fromUtf8("centralwidget"))<br> self.toolButton = QtGui.QToolButton(self.centralwidget)<br> self.toolButton.setGeometry(QtCore.QRect(30, 10, 51, 25))<br> self.toolButton.setObjectName(_fromUtf8("toolButton"))<br> self.qvtkWidget = QVTKRenderWindowInteractor(self.centralwidget)<br> self.qvtkWidget.setGeometry(QtCore.QRect(9, 60, 161, 181))<br> self.qvtkWidget.setObjectName(_fromUtf8("qvtkWidget"))<br><br> self.radioButton = QtGui.QRadioButton(self.centralwidget)<br> self.radioButton.setGeometry(QtCore.QRect(280, 20, 116, 22))<br> self.radioButton.setObjectName(_fromUtf8("radioButton"))<br> self.toolButton_2 = QtGui.QToolButton(self.centralwidget)<br> self.toolButton_2.setGeometry(QtCore.QRect(290, 80, 23, 25))<br> self.toolButton_2.setObjectName(_fromUtf8("toolButton_2"))<br> self.pushButton = QtGui.QPushButton(self.centralwidget)<br> self.pushButton.setGeometry(QtCore.QRect(290, 150, 98, 27))<br> self.pushButton.setObjectName(_fromUtf8("pushButton"))<br> self.line = QtGui.QFrame(self.centralwidget)<br> self.line.setGeometry(QtCore.QRect(300, 210, 281, 16))<br> self.line.setFrameShape(QtGui.QFrame.HLine)<br> self.line.setFrameShadow(QtGui.QFrame.Sunken)<br> self.line.setObjectName(_fromUtf8("line"))<br> self.line_2 = QtGui.QFrame(self.centralwidget)<br> self.line_2.setGeometry(QtCore.QRect(393, 80, 20, 121))<br> self.line_2.setFrameShape(QtGui.QFrame.VLine)<br> self.line_2.setFrameShadow(QtGui.QFrame.Sunken)<br> self.line_2.setObjectName(_fromUtf8("line_2"))<br> self.horizontalLayoutWidget = QtGui.QWidget(self.centralwidget)<br> self.horizontalLayoutWidget.setGeometry(QtCore.QRect(430, 50, 160, 80))<br> self.horizontalLayoutWidget.setObjectName(_fromUtf8("horizontalLayoutWidget"))<br> self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget)<br> self.horizontalLayout.setMargin(0)<br> self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))<br> MainWindow.setCentralWidget(self.centralwidget)<br> self.menubar = QtGui.QMenuBar(MainWindow)<br> self.menubar.setGeometry(QtCore.QRect(0, 0, 626, 25))<br> self.menubar.setObjectName(_fromUtf8("menubar"))<br> self.menuFile = QtGui.QMenu(self.menubar)<br> self.menuFile.setObjectName(_fromUtf8("menuFile"))<br> self.menuEdit = QtGui.QMenu(self.menubar)<br> self.menuHelp.setObjectName(_fromUtf8("menuHelp"))<br> MainWindow.setMenuBar(self.menubar)<br> self.statusbar = QtGui.QStatusBar(MainWindow)<br> self.statusbar.setObjectName(_fromUtf8("statusbar"))<br> MainWindow.setStatusBar(self.statusbar)<br> self.actionOpen = QtGui.QAction(MainWindow)<br> self.actionOpen.setObjectName(_fromUtf8("actionOpen"))<br> self.actionAbout_IncoisVis = QtGui.QAction(MainWindow)<br> self.actionAbout_IncoisVis.setObjectName(_fromUtf8("actionAbout_IncoisVis"))<br> self.actionSave = QtGui.QAction(MainWindow)<br> self.actionSave.setObjectName(_fromUtf8("actionSave"))<br> self.actionSave_As = QtGui.QAction(MainWindow)<br> self.actionSave_As.setObjectName(_fromUtf8("actionSave_As"))<br> self.actionAnimate = QtGui.QAction(MainWindow)<br> self.actionAnimate.setObjectName(_fromUtf8("actionAnimate"))<br> self.menuFile.addAction(self.actionOpen)<br> self.menuFile.addAction(self.actionSave)<br> self.menuFile.addAction(self.actionSave_As)<br> self.menuFile.addAction(self.actionAnimate)<br> self.menuHelp.addAction(self.actionAbout_IncoisVis)<br> self.menubar.addAction(self.menuFile.menuAction())<br> self.menubar.addAction(self.menuEdit.menuAction())<br> self.menubar.addAction(self.menuHelp.menuAction())<br><br> self.retranslateUi(MainWindow)<br> QtCore.QMetaObject.connectSlotsByName(MainWindow)<br><br><br><div><div><div> def retranslateUi(self, MainWindow):<br> MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))<br> self.toolButton.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8))<br> self.radioButton.setText(QtGui.QApplication.translate("MainWindow", "RadioButton", None, QtGui.QApplication.UnicodeUTF8))<br> self.toolButton_2.setText(QtGui.QApplication.translate("MainWindow", "...", None, QtGui.QApplication.UnicodeUTF8))<br> self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "PushButton", None, QtGui.QApplication.UnicodeUTF8))<br> self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8))<br> self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))<br> self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionOpen.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionAbout_IncoisVis.setText(QtGui.QApplication.translate("MainWindow", "About IncoisVis", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionSave.setText(QtGui.QApplication.translate("MainWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionSave_As.setText(QtGui.QApplication.translate("MainWindow", "Save As", None, QtGui.QApplication.UnicodeUTF8))<br> self.actionAnimate.setText(QtGui.QApplication.translate("MainWindow", "Animate", None, QtGui.QApplication.UnicodeUTF8))<br>==================================================<br><br></div><div>================prog.py======================<br><br>import sys<br>from PyQt4 import *<br>import os<br>import platform<br>import stat<br>import sys<br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br><br><br>import sample<br><br>class MainWindow(QMainWindow, sample.Ui_MainWindow):<br> def __init__(self, parent=None):<br> super(MainWindow, self).__init__(parent)<br> self.setupUi(self)<br><br>if __name__ == '__main__':<br><br> app = QApplication(sys.argv)<br><br> form = MainWindow()<br> form.show()<br><br> sys.exit(app.exec_())<br>==============================================<br><br></div><div>To Run :<br><br><b>python ./prog.py </b><br><br></div><div>I get the output gui, but in that GUI the canvas related to VTK render Window is not appearing. Could you please any1 help me.<br><br></div><div><br clear="all"></div><div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font color="#ff0000"> </font><font color="#ff6600">Thanks and Regards,</font></div><div><font color="#3366ff"><br></font></div><div><span style="color:rgb(51,102,255)"> Manjunath K E</span><font color="#3366ff"></font></div><div><font color="#3366ff"><span style="color:rgb(241,194,50)"> Help Ever Hurt Never</span><br></font></div><div><font color="#3366ff"> </font></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div></div></div>