<div dir="ltr">Thank you for the quick example. <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "> </span><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br>
</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Quoting from my previous mail &quot;I am using Python2.6 which comes with Pythonxy package. So I do not build VTK separately. It comes with Pythonxy too. Now, in the site_packages/vtk/qt I cannot find QVTKWidget. Also, in my separate build of VTK (with </span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">VTK_WRAP_PYTHON set) I do not get QVTKWidget iniside bin/wrapping/python/vtk/qt. Where can I get it from?&quot;</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">When I run the example, I get the obvious error: &#39;AttributeError: &#39;module&#39; object has no attribute &#39;QVTKWidget&#39;. Meanwhile, I will try to see if QVTKRenderWindowInteractor works for me.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">- Prathamesh</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 8:52 AM, Eric E. Monson <span dir="ltr">&lt;<a href="mailto:emonson@cs.duke.edu">emonson@cs.duke.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word">Hello Prathamesh,<div><br></div><div>Yes, it would help us diagnose your problems if you tell us which version of VTK you are using, on what platform, and whether you built it yourself (with VTK_WRAP_PYTHON_SIP: ON, which is required for the Python wrapping of QVTKWidget).</div>
<div><br></div><div>I&#39;ve had some troubles with getting installed versions of VTK to work automatically with the SIP Python wrapped classes, so for now I just set my library path and pythonpath to directories in the build tree (this is with bash on OS X):</div>
<div><br></div><div>export VTK_DIR=/Users/emonson/Programming/VTK_git/VTK/build</div><div><div>export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${VTK_DIR}/bin</div><div>export PYTHONPATH=$PYTHONPATH:${VTK_DIR}/bin:${VTK_DIR}/Wrapping/Python</div>
<div><br></div><div>Once everything is built correctly and the paths are set, then import vtk.qvtk should work. I&#39;ll attach a simple example at the end in case you need a script example.</div><div><br></div><div>Also, just in case you didn&#39;t know, there is still the older QVTKRenderWindowInteractor which can be used to add a VTK render window to a PyQt app without building the SIP Python wrappers -- it&#39;s limited in a couple ways, but basically works fine for many applications.</div>
<div><br></div><div>Talk to you later,</div><div>-Eric</div><div><br></div><div>
<span style="border-collapse:separate;color:rgb(0, 0, 0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>
------------------------------------------------------</div><div>Eric E Monson</div><div>Duke Visualization Technology Group</div><div><br></div></span></div><div><br></div><div># ==============================</div><div>
<div>from PyQt4 import QtCore, QtGui</div><div>import vtk</div><div>import sys</div><div><br></div><div>class Ui_MainWindow(object):</div><div><span style="white-space:pre-wrap">        </span>def setupUi(self, MainWindow):</div>
<div><span style="white-space:pre-wrap">                </span>MainWindow.setObjectName(&quot;MainWindow&quot;)</div><div><span style="white-space:pre-wrap">                </span>MainWindow.resize(400, 400)</div><div><span style="white-space:pre-wrap">                </span>self.centralWidget = QtGui.QWidget(MainWindow)</div>
<div><span style="white-space:pre-wrap">                </span>self.gridlayout = QtGui.QGridLayout(self.centralWidget)</div><div><span style="white-space:pre-wrap">                </span>self.vtkWidget = vtk.QVTKWidget(self.centralWidget)</div><div>
<span style="white-space:pre-wrap">                </span>self.gridlayout.addWidget(self.vtkWidget, 0, 0, 1, 1)</div><div><span style="white-space:pre-wrap">                </span>MainWindow.setCentralWidget(self.centralWidget)</div><div><br></div><div>
class SimpleView(QtGui.QMainWindow):</div><div>    </div><div><span style="white-space:pre-wrap">        </span>def __init__(self, parent = None):</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">                </span>QtGui.QMainWindow.__init__(self, parent)</div>
<div><span style="white-space:pre-wrap">                </span>self.ui = Ui_MainWindow() </div><div><span style="white-space:pre-wrap">                </span>self.ui.setupUi(self)</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>widget = self.ui.vtkWidget</div>
<div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>ren = vtk.vtkRenderer()</div><div><span style="white-space:pre-wrap">                </span>renwin = widget.GetRenderWindow()</div>
<div><span style="white-space:pre-wrap">                </span>renwin.AddRenderer(ren)</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>cone = vtk.vtkConeSource()</div><div><span style="white-space:pre-wrap">                </span>mapper = vtk.vtkPolyDataMapper()</div>
<div><span style="white-space:pre-wrap">                </span>mapper.SetInputConnection(cone.GetOutputPort())</div><div><span style="white-space:pre-wrap">                </span>actor = vtk.vtkActor()</div><div><span style="white-space:pre-wrap">                </span>actor.SetMapper(mapper)</div>
<div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>ren.AddViewProp(actor)</div><div><span style="white-space:pre-wrap">                </span>ren.ResetCamera()</div><div><span style="white-space:pre-wrap">                                </span></div>
<div>if __name__ == &quot;__main__&quot;:</div><div><br></div><div>    app = QtGui.QApplication(sys.argv)</div><div>    window = SimpleView()</div><div>    window.show()</div><div>    sys.exit(app.exec_())</div></div><div>
<div></div><div class="h5"><div><br></div>
<br><div><div>On Nov 3, 2010, at 6:18 AM, Jothy wrote:</div><br><blockquote type="cite"><div dir="ltr">Which python bundle are you using and how are importing the QVTK?<br><br>One easiest option is to add the QVTKWidget into your working directory and import.<br>
<br>Jothy<br><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 3:45 AM, Prathamesh Kulkarni <span dir="ltr">&lt;<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204, 204, 204);padding-left:1ex"><div dir="ltr">
Hello all,<br><br>I want to create a GUI using PyQt4 and display a vtkImage inside it. For that, I need to embed a QVTKWidget in my GUI. However, I get &#39;ImportError: No module named qvtk&#39; when I do import vtk.qvtk as given in <a href="http://vtk.1045678.n5.nabble.com/about-vtk-python-bindings-and-Qt-td2841114i20.html" target="_blank">http://vtk.1045678.n5.nabble.com/about-vtk-python-bindings-and-Qt-td2841114i20.html</a> . I am confused about how to get started with this and did not find examples demonstrating this. <br>



<div><br></div><div>Please point me to the steps for writing this &quot;hello world&quot;.</div><div><br></div><div>Thanks,</div><div>Prathamesh</div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div></div></div></div></blockquote></div><br></div></div>