Need Suggestions for Python/Tk/VTK
Eric Brunel
eric_brunel at despammed.com
Mon May 3 04:23:43 EDT 2004
Yang Wang wrote:
> Dear All,
>
> I am totally new to Python, however had some experience with Tcl/Tk.
> Currently I am doing a project that will need Python/Tk as well
> as VTK(Visualization Toolkit) for image processing and visualization.
>
> Have anyone had any experience in this that can give me some suggestions
> or references? And I also wonder how Tk is working with Python in
> the process of constructing GUI, is it like the way that with Tcl?
>
> Any help will be greatly appreicated. Thanks.
>
> Yours,
> Casper
I never used VTK, so I cannot help you for this part. As for the GUI
construction process in Python/Tkinter, the only difference with tcl/tk is the
syntax. For example, instead of doing in tcl:
frame .frm -width 500 -height 200 -bd 3 -fg red
pack .frame -side top
in Python, you'll do:
## Import the Tkinter module
from Tkinter import *
## Initialize Tkinter/tk
root = Tk()
## The next two lines are the equivalent of the two tcl lines above
frm = Frame(root, width=500, height=200, bd=3, fg='red')
frm.pack(side=TOP)
So you see, it's quite straightforward. The concepts, widgets, operations,
options, ... are exactly identical in Python/Tkinter and tcl/tk. In fact, the
Tkinter module actually creates a tcl interpreter in the background and converts
all calls to Tkinter objects to tcl commands. So once you've understood how to
convert tcl syntax to Python/Tkinter syntax, you can even use the tcl/tk manual
pages as a reference.
HTH
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list
mailing list