converting from tcl/tkl to python

Discussion in 'Python' started by Richard Boothroyd, Mar 9, 2012.

  1. Hi there,

    First, I am not a developer so go easy on my ignorance ;-). Our
    company designs and develops hearing aid audibility fitting equipment.
    ( 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.

    Also, if there is anyone out there that has specific expertise in
    performing this conversion please contact me.

    Richard Boothroyd
    General Manager
    Richard Boothroyd, Mar 9, 2012
    1. Advertisements

  2. Richard Boothroyd

    Rod Person Guest

    Have you looked at Tile? It a theme-able widget set for Tk.

    As for python, the default GUI toolkit for Python is Tk, but there are
    bindings that allow you to use WxWidgets, Qt and GTK.
    Rod Person, Mar 9, 2012
    1. Advertisements

  3. Richard Boothroyd

    Kevin Walzer Guest

    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

    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 Walzer, Mar 9, 2012
  4. Richard Boothroyd

    Mark Roseman Guest

    Hi Richard,

    I would strongly second the advice that Kevin provided: rewriting is a
    substantial step not to be taken lightly. If a mere facelift is desired,
    migrating to the more modern tools provided in recent versions of Tcl/Tk
    may well meet your needs at a fraction of the cost/effort.

    For additional information, you can point your technical people at

    Mark Roseman, Mar 9, 2012
  5. 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, Mar 9, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.