[vtkusers] How to build VTK in python while working with Windows XP
Sven Prevrhal
sven.prevrhal at radiology.ucsf.edu
Tue May 30 15:25:42 EDT 2006
Sure thing.
1. Get a C++ compiler (cygwin gcc, Visual Studio 7 and up etc will work
fine)
2. Get the source (for vtk 5.0, from here
http://www.vtk.org/files/release/5.0/vtk-5.0.0.zip)
3. Install Python 2.4
4. Install CMake http://www.cmake.org/HTML/Index.html
5. Use CMake to configure the vtk build: When you start it, it will ask you
for the directory containing the vtk sources and a directory where to build
(do not choose the source directory here!). Also choose the compiler you
want to use. After the first run of "Configure" a lot of cache values will
be shown. Set BUILD_SHARED_LIBS and VTK_WRAP_PYTHON to ON, then configure
again. If there are any problems (like CMake not finding your Python
installation), fix them and configure until they are all gone. Then hit OK.
CMake will configure the build and close
6. Navigate to the build directory and start your compiler. For instance,
for MS Visual Studio, you can simply double-click the .sln file. Make sure
the configuration is set to "Release" or "ReleaseWithDebugInfo" (by default
it's "Debug" which causes problems later.) Choose a full build and start it.
7. Go for a coffee or two as this will run a long time.
8. In your python install directory, navigate to Libs\site-packages and
create a text file named vtk.pth. It should contain the following three
lines
E:\users\sprevrhal\packages\VTK-nightly-22MAR06\Wrapping\Python
E:\users\sprevrhal\packages\VTK-nightly-22MAR06\Wrapping\Python\vtk\tk
E:\users\sprevrhal\packages\VTK-nightly-22MAR06\bin\release
where the E:\users\sprevrhal\packages\VTK-nightly-22MAR06 part needs to be
replaced with the path to your vtk build directory.
If something goes wrong, be sure to check the mailing list archives
http://www.kitware.com/searchpublic.html
- Sven
-----Original Message-----
From: raashid baig [mailto:indianboyfriend at hotmail.com]
Sent: Tuesday, May 30, 2006 11:27 AM
To: Sven Prevrhal
Subject: Thanks a lot
Hi Sven,
Thanks a lot for answering I thought that no one would answer, Thanks a lot
again.
Please understand my condition, I am a complete idiot in computing and
coding, and I have just started to use the Python programming language 5
months ago.
I am trying to start using VTK as a visualization tool as a part of my
M.Tech project.
Please tell me the step by step proccedure of installing the VTK and
wrapping it with python
(My python is working fine in an XP machine and I am able to work with
OpenGL properly under python),
I know that you are probably very intelligent but uderstand my condition as
I have wasted 2-3 weeks to solve this problem.
Please spare some of your time and help me out.
Raashid Baig
----------------------------------------
> From: sven.prevrhal at radiology.ucsf.edu
> To: vtkusers at vtk.org; indianboyfriend at hotmail.com
> Subject: RE: [vtkusers] How to build VTK in python while working with
Windows XP
> Date: Tue, 30 May 2006 09:37:53 -0700
>
> Hi Raashed,
> See http://www.vtk.org/get-software.php : For Python support, you will
have
> to compile the software. I am using Python 2.4 with vtk 5 and up on
Windows
> XP just fine.
>
> - Sven
>
>
> -----Original Message-----
> From: raashid baig [mailto:indianboyfriend at hotmail.com]
> Sent: Tuesday, May 30, 2006 12:39 AM
> To: vtkusers at vtk.org
> Subject: [vtkusers] How to build VTK in python while working with Windows
XP
>
> Hi,
> I am very new to Python and VTK and I am using them on a machine running
on
> Windows XP. Somebody please help me by telling how to install VTK so that
it
> could be used in Python with IDLE as an editor.
>
> I have downloaded the vtk-5.0.0-win32.exe and installed it in the
default
> directory C:\Program File\VTK 5.0 but how to use the while importing
modules
> in Python does'nt click to me.
>
> I even tried the enthon-python2.3-0.9.6.exe but it too was unable to
> import modules from the vtk dirctory when I used the following code in
IDLE:
>
> from Tkinter import *
> from VTK import *
>
> # Make a root window
> root = Tk()
>
> # Add a vtkTkRenderWidget
> renderWidget = vtkTkRenderWidget(root,width=400,height=400)
> renderWidget.pack(expand='true',fill='both')
>
> # Get the render window from the widget
> renWin = renderWidget.GetRenderWindow()
>
> # Next, do the VTK stuff
> ren = vtkRenderer()
> renWin.AddRenderer(ren)
> cone = vtkConeSource()
> cone.SetResolution(16)
> coneMapper = vtkPolyDataMapper()
> coneMapper.SetInput(cone.GetOutput())
> coneActor = vtkActor()
> coneActor.SetMapper(coneMapper)
> ren.AddActor(coneActor)
>
> # Make a quit button
> def quit():
> root.destroy()
>
> button = Button(text="Quit",command=quit)
> button.pack(expand='true',fill='x')
>
> # start up the event loop
> root.mainloop()
>
>
> Please somebody help me with the above problem so that I could start
learing
> VTK.
>
> Raashid Baig
> _________________________________________________________________
> Enter the Windows Live Mail beta sweepstakes
> http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx
>
>
_________________________________________________________________
Enter the Windows Live Mail beta sweepstakes
http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx
More information about the vtkusers
mailing list