GUI:-please answer want to learn GUI programming in python , how should i proceed.

Terry Reedy tjreedy at udel.edu
Sat Dec 14 22:00:55 CET 2013


On 12/14/2013 3:01 PM, Michael Torrie wrote:
> On 12/14/2013 10:05 AM, Wolfgang Keller wrote:
>> Tkinter is a bit "special" to use since it's not just a library, but
>> uses some kind of RPC. It seems that "look and feel" have been greatly
>> improved lately.
>
> I know Tkinter originated with the Tcl/Tk language.

Tcl is the language. Its standard interpreter is written in C, as with 
Python. (I do not know if there are other Tcl implementations.) Tk is 
the gui framework written, I believe, in a mixture of Tcl and C.

Tkinter (Tk interface) is entirely a Python to Tcl/Tk and back interface.

> With Tkinter in Python is it still using Tcl/Tk under the hood?

Yes.  _tkinter.c defines Python-callable functions that call Tcl/Tk C 
api functions. tkinter.py defines Python classes and methods. The 
methods call _tkinter functions. Most of the classes correspond to Tk 
widgets such as Button and Text.

> IE embeds the Tcl language interpreter into Python's interpreter?

Both interpreters run in one process.

 > If so I've always found
> it a bit strange that the de facto GUI library that's shipped with
> Python ships an entirely different language with it under the hood.

Tcl/Tk is only shipped with the Windows Python installer. On other 
systems, it is a separate install if not already present.

There once (over 10 years ago) was a project to re-write Tk entirely in 
C. What I read it that people decided that Tk made too much use of Tcl 
functions to make that worthwhile.

There have been starts on projects to write a gui framework based on 
Python and wrapped C libraries. PyGui is one, last updated July 2011.
http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/

-- 
Terry Jan Reedy




More information about the Python-list mailing list