thanks guys, I've the title working now.<br><br>For a touch of perfection; is there a way to automatically set the window coordinates so that the windows are aligned wherever you want them?<br>(i.e. next to each other?)<br>
<br><br>And one last question: after the first render window has been created, the program waits for me to press 'q' to continue the program. Is<br>there a way for the program to continue without pressing 'q'?<br>
<br>I tried: renwindow->Finalize(); // doesn't do anything<br><br>windowinteractor->TerminateApp(); // this closes the application altogether when 'q' is pressed<br><br>windowinteractor->UnRegister(); // error: no matching function call<br>
// note: candidates are: virtual void vtkRenderWindowInteractor::UnRegister(vtkObjectBase*)<br><br>windowinteractor->CreateOneShotTimer(1); // doesn't release focus<br>
<br>I'd just like all windows to pop up as soon as possible and be able to manipulate them with my mouse whenever I'd like to.<br>At this point I can manipulate all renderwindows fine, I'd just like the windows to appear without having to press 'q'.<br>
<br>cheers, Michael<br><br><div class="gmail_quote">On Tue, Jan 5, 2010 at 10:42 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Tue, Jan 5, 2010 at 5:22 PM, Bryan P. Conrad <<a href="mailto:conrabp@ortho.ufl.edu">conrabp@ortho.ufl.edu</a>> wrote:<br>
> I have only done this in python, not C++, but I think the trick is to use the method "SetWindowName" and it has to be called *after* the renderWindow is rendered the first time. See the python code below (copied from David's C++ example), for a version that works on my machine.<br>
><br>
> import vtk<br>
><br>
> def main():<br>
> #Create a sphere<br>
> sphereSource = vtk.vtkSphereSource()<br>
> sphereSource.SetCenter(0.0, 0.0, 0.0)<br>
> sphereSource.SetRadius(5)<br>
><br>
> #Create a mapper and actor<br>
> mapper = vtk.vtkPolyDataMapper()<br>
> mapper.SetInputConnection(sphereSource.GetOutputPort())<br>
> actor = vtk.vtkActor()<br>
> actor.SetMapper(mapper)<br>
><br>
> # Setup a renderer, render window, and interactor<br>
> renderer = vtk.vtkRenderer()<br>
> renderWindow = vtk.vtkRenderWindow()<br>
> #renderWindow.SetWindowName("Test")<br>
><br>
> renderWindow.AddRenderer(renderer);<br>
> renderWindowInteractor = vtk.vtkRenderWindowInteractor()<br>
> renderWindowInteractor.SetRenderWindow(renderWindow)<br>
><br>
> #Add the actor to the scene<br>
> renderer.AddActor(actor)<br>
> renderer.SetBackground(1,1,1) # Background color white<br>
><br>
> #Render and interact<br>
> renderWindow.Render()<br>
><br>
> #*** SetWindowName after renderWindow.Render() is called***<br>
> renderWindow.SetWindowName("Test")<br>
><br>
> renderWindowInteractor.Start()<br>
><br>
><br>
> if __name__ == '__main__':<br>
> main()<br>
><br>
> ____________________________<br>
> Bryan P. Conrad, Ph.D.<br>
> Senior Engineer<br>
><br>
> Department of Orthopaedics and Rehabilitation<br>
> University of Florida<br>
> PO Box 112727<br>
> Gainesville, FL 32611<br>
> Phone: 352.273.7412<br>
> Fax: 352.273.7407<br>
><br>
> -----Original Message-----<br>
> From: <a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a> [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>] On Behalf Of David Doria<br>
> Sent: Tuesday, January 05, 2010 2:07 PM<br>
> Cc: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
> Subject: Re: [vtkusers] giving renderwindow a name<br>
><br>
> On Tue, Jan 5, 2010 at 11:25 AM, michiel mentink<br>
> <<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>> wrote:<br>
>> I'm trying to give a renderwindow a title.<br>
>><br>
>> I'm using the following code to create a window. So far so good.<br>
>><br>
>> // create a renderer<br>
>> vtkSmartPointer<vtkRenderer> renderer =<br>
>> vtkSmartPointer<vtkRenderer>::New();<br>
>> renderer->AddActor(actor);<br>
>><br>
>> // create a render window<br>
>> vtkSmartPointer<vtkRenderWindow> renwin =<br>
>> vtkSmartPointer<vtkRenderWindow>::New();<br>
>> renwin->AddRenderer(renderer);<br>
>><br>
>><br>
>> // create an interactor<br>
>> vtkSmartPointer<vtkRenderWindowInteractor> iren =<br>
>> vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
>> iren->SetRenderWindow(renwin);<br>
>> renwin->SetSize(640, 480);<br>
>><br>
>> iren->Initialize();<br>
>> iren->Start();<br>
>><br>
>><br>
>> ///////////end code////////<br>
>><br>
>> Before iren->initialize, I tried the following:<br>
>><br>
>> iren->SetWindowInfo( "window1" );<br>
>> renwin->SetWindowInfo( "window1");<br>
>><br>
>> and also ->SetWindowId("window1");<br>
>> and ->SetWindowName("window1");<br>
>><br>
>> but it keeps giving me error messages upon compiling:<br>
>><br>
>> 'class vtkRenderWindowInteractor' has no member named 'SetWindowInfo'<br>
>> or<br>
>> error: 'renWin' was not declared in this scope<br>
>><br>
>><br>
>> It's probably a simple mistake, but I'm still beginning to understand VTK.<br>
>> Can anybody point me in the right direction?<br>
>><br>
>> Kind regards, Michael<br>
>><br>
>><br>
><br>
> I setup an example if anyone cares to play with it to get it to work:<br>
> <a href="http://www.cmake.org/Wiki/VTK/Examples/WindowTitle" target="_blank">http://www.cmake.org/Wiki/VTK/Examples/WindowTitle</a><br>
><br>
> Thanks,<br>
><br>
> David<br>
<br>
</div></div>Thanks Bryan, that did the trick.<br>
<br>
The example can be found here (c++):<br>
<div class="im"><a href="http://www.cmake.org/Wiki/VTK/Examples/WindowTitle" target="_blank">http://www.cmake.org/Wiki/VTK/Examples/WindowTitle</a><br>
</div>and here(python): <a href="http://www.cmake.org/Wiki/VTK/Examples/Python/WindowTitle" target="_blank">http://www.cmake.org/Wiki/VTK/Examples/Python/WindowTitle</a><br>
<div><div></div><div class="h5"><br>
Thanks,<br>
<br>
David<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>
</div></div></blockquote></div><br>