converting from tcl/tkl to python

Kevin Walzer kw at codebykevin.com
Fri Mar 9 10:59:09 EST 2012


On 3/9/12 10:10 AM, Richard Boothroyd wrote:

> First, I am not a developer so go easy on my ignorance ;-). Our
> company designs and develops hearing aid audibility fitting equipment.
> (www.audioscan.com). Our current software GUI is all based on TCL/TKL
> and we are running into issues on developing a "prettier" GUI in an
> effort to modernize some of our equipment.
>
> My understanding is that Python is a much better GUI tool than TCL/TKL
> so I'd appreciate any insight on this assumption. Also I'm wondering
> what kind of effort and expertise it would take to convert from TCL/
> TKL to Python. Let me know what further info you may require.
>

First, don't assume that Tcl/Tk is not up to the job. I took a look at 
some of your software screenshots at your website and noticed that you 
are using the "classic" Tk widgets, which, while functional, are a bit 
dated in their appearance. Tcl/Tk 8.5 has added a separate group of 
widgets called the ttk (for "themed Tk")  widgets that are fully native 
in appearance on Windows/Mac and much improved in their appearance on 
Linux/Unix. Here's a screenshot of a Tcl/Tk app using the ttk widgets on 
Windows:

http://sourceforge.net/p/windowstoolset/screenshot/screenshot.png

If modernizing the UI is all you need to do, a careful update of your 
code using the themed Tk widgets will take you a long way, with far less 
work and cost than porting your code to Python.

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.

2. Python also has bindings for many other UI toolkits, including 
wxWidgets (a very nice cross-platform toolkit that has native UI 
bindings), Qt, Gtk, and others. If you prefer a different 
design/toolkit/API, these may be worth a look. However, if you opt for 
one of these toolkits and Python, then you are essentially starting from 
scratch with your software--it will be a complete rewrite not just in 
the programming language but also in the UI design as well. That will 
take a great deal of additional time and cost.

To sum up: a rewrite of your software in Python will amount a 
major-to-complete overhaul of the code base, depending on how you 
approach the UI design--and this will involve significant cost and time. 
This may make sense if you feel you have reached the end of the line 
with Tcl and your desire for a different language is for reasons in 
addition to the look and feel of the UI. However, if your software and 
its code is otherwise satisfactory and you need simply to update the UI 
design, that can be done in Tcl at far less cost using the ttk widgets.

Hope this helps,

Kevin
-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com



More information about the Python-list mailing list