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

Christian Gollwitzer auriocus at gmx.de
Tue Dec 17 03:11:54 EST 2013


Am 17.12.13 06:37, schrieb Rick Johnson:
> On Sunday, December 15, 2013 11:01:53 AM UTC-6, Steven D'Aprano wrote:
>> low-level language with some interface to Python. The main
>> difference between this hypothetical "Python GUI" and Tcl
>> is that Tcl is a Turing-complete interpreter which lives
>> in it's own process.
>
> And how many times would you take advantage of that "turning
> complete" functionality in reality? My answer... ZERO! How
> many Tcl calls have you, or anybody, made that did have
> direct business with creating or managing a TK gui? HOW
> MANY???

There are some useful extensions to Tk written in Tcl. For example, 
there is tablelist - a tree widget or multicolumn listbox in pure Tcl. 
By passing it to the Tcl interpreter, you can wrap it up for Python - 
that's what Kevin Walzer did at

http://tkinter.unpythonic.net/wiki/TableListWrapper

It would take many man-month to reproduce this thing in Python.


Another example is the file open dialog (import tkFileDialog). On 
Windows and OSX, it uses the native variants, but on X11 it uses a very 
outdated, ugly and hard to use thing bundled with Tk. With just a few 
lines executed by some Tk.eval('source myfixes.tcl'), I overwrite this 
dialog box with the one created by Schelte Bron:
http://wiki.tcl.tk/15897

For reference, here is myfixes.tcl:

lappend auto_path [file dirname [info script]]
if {[tk windowingsystem] == "x11" } {
	package require fsdialog
	interp alias {} tk_getOpenFile {} ttk::getOpenFile
	interp alias {} tk_getSaveFile {} ttk::getSaveFile
	interp alias {} tk_chooseDirectory {} ttk::chooseDirectory
}

Christian



More information about the Python-list mailing list