<div dir="ltr">Keep the messages on the list.<br><br>"""A simple example that uses the QVTKRenderWindowInteractor class."""<br><br> # every QT app needs an app<br> app = QtGui.QApplication(['QVTKRenderWindowInteractor'])<br>
<br> # create the widget<br> widget = QVTKRenderWindowInteractor()<br> widget.Initialize()<br> widget.Start()<br> # if you dont want the 'q' key to exit comment this.<br> widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())<br>
<br> ren = vtk.vtkRenderer()<br> widget.GetRenderWindow().AddRenderer(ren)<br><br> cone = vtk.vtkConeSource()<br> cone.SetResolution(8)<br><br> coneMapper = vtk.vtkPolyDataMapper()<br> coneMapper.SetInput(cone.GetOutput())<br>
<br> coneActor = vtk.vtkActor()<br> coneActor.SetMapper(coneMapper)<br><br> ren.AddActor(coneActor)<br><br> # show the widget<br> widget.show()<br> # start event processing<br> app.exec_()<br><br><div class="gmail_quote">
On Wed, Nov 3, 2010 at 5:41 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com">prathameshmkulkarni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Got it! The ui file was corrupted due to some reason. Now I'll try the remaining steps you told me. Also, if you have a simple example using QVTKWidget or QVTKRenderWindowInteractor (with or without using Qt Designer), please forward it to me. I am learning to many things at the same time!<div>
<br></div><div>Thanks,</div><div>Prathamesh<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 12:30 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">I run it in windows cmd, and now I get this:<div><br></div><div><div>pyuic4 -o ui_sampleui1.py sampleui1.ui</div>
<div><br></div><div>Error in input file: not well-formed (invalid token): line 1, column 1</div><div><div></div><div>
<br><div class="gmail_quote">On Wed, Nov 3, 2010 at 12:23 PM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Are you typing pyuic4 in windows command prompt or some where else. I mean the window you get by typing start->run->cmd<br><br>you don't need to import pyqt4 before typing pyuic4<br><font color="#888888"><br>
Jothy</font><div><div></div><div><br><br>
<div class="gmail_quote">On Wed, Nov 3, 2010 at 5:19 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Yes, I have the batch file in site_packages/PyQt4. When I do: <div><br></div><div><div>import PyQt4</div><div>>>> pyuic4 -o sampleui.ui ui_sampleui1.py</div><div><br></div><div>I get:</div><div><br>
</div><div> File "<console>", line 1</div><div> pyuic4 -o sampleui.ui ui_sampleui1.py</div><div> ^</div><div>SyntaxError: invalid syntax</div><div><br></div><div>I have also tried full paths. Where am I going wrong?</div>
<div><br></div><font color="#888888"><div>- Prathamesh</div></font><div><div></div><div><div><br></div><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 12:10 PM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">pyuic4 is a bat file. Go to command window and type pyuic4 -o inputfile outputfile.<br>
<font color="#888888"><br>
Jothy<br></font><div><div></div><div><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 5:07 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">Thank you! I will try this out. Currently, I cannot find pyuic4! I'll try to write the .py files for the GUI.<div>
<br></div><div><font color="#888888">- Prathamesh</font><div><div></div><div><br><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 11:33 AM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">I have attacehd the latest version (hope so!) of QVTKWidget. Add it to your working dir and follow the tricks/steps given below<br>
<br>1) In your form add a QFrame from designer where you want a QVTKWidget (let's say the object name is qvtkWidget1)<br>
<br>2)Run pyuic4 to generate (Form1).ui files to (ui_Form1).py files<br><br><div class="gmail_quote">3) Now add the line "import QVTKWidget as QVW " in the ui_Form1.py file, above the class definition<br><br>4) Actual trick is, replace <b style="color: rgb(0, 0, 153);">self. qvtkWidget1 = QFrame(parent) as self.qvtkWidget1=QVW.QVTKRenderWindowInteractor(parent)</b><br>
<br>5) uncomment the lines which add style/border as it would say during run-time "no attribute found".<br><br>Hope this helps!<br><font color="#888888"><br>Jothy</font><div><div></div><div><br><br><br>
On Wed, Nov 3, 2010 at 4:03 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">Yes, I selected "Full". I get the QVTKRenderWindowInteractor. I wanted to use the QVTKWidget since, I have used it earlier in my C++ projects. Never-the-less, is there any example demonstrating the use of QQVTKRenderWindowInteractor? (I am completely new to Python) Can I promote a QWidget to it, like I did for QVTKWidget through the Qt Designer?<div>
<br></div><div>Thanks,</div><div>Prathamesh<div><div></div><div><br><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 10:50 AM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">If you are using python x,y you should have QVTKRenderWindowInteractor.py in<br><br>C:\Python26\Lib\site-packages\vtk\qt4<br><br>Did you select "Full" during installation of pythonx,y?<div>
<br><br>Jothy<br>
<br><div class="gmail_quote">On Wed, Nov 3, 2010 at 3:45 PM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">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 VTK_WRAP_PYTHON set) I do not get QVTKWidget iniside bin/wrapping/python/vtk/qt. Where can I get it from?<div>
<br></div><div><font color="#888888">- Prathamesh</font><div><div></div><div><br><br><div class="gmail_quote">On Wed, Nov 3, 2010 at 5:18 AM, Jothy <span dir="ltr"><<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<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"><div>
<div></div><div>On Wed, Nov 3, 2010 at 3:45 AM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:prathameshmkulkarni@gmail.com" target="_blank">prathameshmkulkarni@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div><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 'ImportError: No module named qvtk' 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 "hello world".</div><div><br></div><div>Thanks,</div><div>Prathamesh</div></div>
<br></div></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>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>