converting from tcl/tkl to python

Grant Edwards invalid at invalid.invalid
Fri Mar 9 15:54:48 EST 2012


On 2012-03-09, Kevin Walzer <kw at codebykevin.com> wrote:

> Having said this, if you are seeing other issues with Tcl (lack of 
> support for certain libraries/API's, code is becoming unmanagable, etc.) 
> and you have concluded that Python is a superior choice overall, then 
> there are a number of different routes you can take:
>
> 1. Python's built-in GUI toolkit is a wrapper for Tk called Tkinter. 
> Recent versions of Python support the themed Tk widgets as well as the 
> classic Tk widgets. Doing a port of your code from Tcl/Tk to Python will 
> be somewhat simpler if you use Python's Tkinter library, because the 
> general layout will be similar. However, there are no automated tools 
> for mapping Tk to Tkinter that I am aware of--you will have to do a 
> rewrite of your code.

If you _do_ decide a rewrite of your code is in order, trying to
"convert" your existing code will mostly likey produce a mess.  Python
and Tcl are very different languages.  Trying to write a Tcl program
in Python won't work very well.  The right thing to do is to carefully
figure out what the requirements are (you should probably even write
them down). Then sit down with a blank slate and
design/build/grow/write a Python application.

Evaluating and choosing a GUI framework (Tk, Wx, Gtk, Qt, etc.) can
take quite a bit of time, so remember to allow for that.  If you
decide to skip that step and stick with Tk, then you've got a bit of
head start since you know how Tk works (assuming the API for the newer
themed widgets isn't too much different than the old widgets).

-- 
Grant Edwards               grant.b.edwards        Yow! Give them RADAR-GUIDED
                                  at               SKEE-BALL LANES and
                              gmail.com            VELVEETA BURRITOS!!



More information about the Python-list mailing list