[Paraview] Graphic window disappears using: pvpython sphere.py

pat marion pat.marion at kitware.com
Wed Jun 30 14:53:54 EDT 2010


A few more notes-

If you use the script I just posted, make sure the interactor is initialized
before the first call to render- it must be initialized before the opengl
window is created.

In the current version of paraview, it is not necessary to call Connect(),
this is done automatically when paraview.simple is imported.

It's not a good idea to include the line:  'from paraview.servermanager
import *'.  You should just access servermanager methods via the sermanager
namespace that is created when you import paraview.simple *.


Pat


On Wed, Jun 30, 2010 at 2:48 PM, pat marion <pat.marion at kitware.com> wrote:

> Unfortunately, pvpython does not support render window interaction.  But
> you can make it work with a extra scripting:
>
> from paraview.simple import *
>
> # Create a view
> view = CreateRenderView()
>
> # Initialize a new interactor
> from libvtkRenderingPython import *
> iren = vtkRenderWindowInteractor()
> iren.SetInteractorStyle(vtkInteractorStyleTrackball())
> iren.SetRenderWindow(view.GetRenderWindow())
> iren.Initialize()
>
> # Build pipeline
> Sphere()
> Show()
> Render()
>
> # Start interaction
> iren.Start()
>
>
> In interactive pvpython, you can go to the window and hit 'q' to give focus
> back to the command line, then call iren.Start() again to give focus back to
> the window.
>
>
> Pat
>
>
> On Wed, Jun 30, 2010 at 2:34 PM, Ted Thompson <tedthompson61 at gmail.com>wrote:
>
>> I am trying to draw 3D graphics using the pvpython shell. The following
>> file is named sphere.py
>>
>> -----------------------
>> import os
>> import paraview
>> from paraview.simple import *
>> from paraview.servermanager import *
>> Connect()
>> sph=Sphere()
>> Show(sph)
>> Render()
>> -------------------
>>
>> I execute the following command from a DOS cmd window:
>>
>> pvpython sphere.py
>>
>> These commands appear to work and a window is created showing the sphere
>> but it immediately goes away. Do I need some type of wait command in the
>> script? When I execute these commands interactively in the pvpython window
>> the window locks up. When I execute them, minus the Connect() in the
>> Paraview GUI provided Python window they work fine.
>>
>> I want a separate graphics window with no GUI shown.
>>
>> What am I missing here?
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100630/bb29ec0e/attachment.htm>


More information about the ParaView mailing list