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

Chris Angelico rosuav at gmail.com
Mon Dec 16 00:08:06 EST 2013


On Mon, Dec 16, 2013 at 3:51 PM, Michael Torrie <torriem at gmail.com> wrote:
> I think Python is a great overall application development language,
> especially for the GUI.  First-class functions for callbacks make it
> very nice compared to other languages.  Python  is fast enough for
> full-blown apps too.  Slow parts can be factored out to other languages.

Python is sooooooo slow when it waits for the human. That pesky
input() function can take *minutes* to return. It's terrible! Factor
that out and your job's done.

And yeah. First-class functions *rock*. ECMAScript is almost there -
not supremely, perhaps, but oh so "all-but"! [1] A function can retain
all sorts of state by being a closure, and yet somehow it doesn't
retain the state of which 'this' (in Python terms, 'self') it should
reference. Why? I don't know. But it's part of the spec now, so
callbacks have to take a function and a context.

var func=document.getElementById;
var foo=func("foo"); /* Won't work */

function funcgen(obj)
{
    return function(desc) {return obj.getElementById(desc);}
}
var func=funcgen(document);
var foo=func("foo"); /* Will work! */

In Python, the simple and obvious thing works, because there's less
magic. The incantation "obj.member" followed by the incantation
"callable(args)" has exactly the same meaning as "obj.method(args)".

ChrisA

[1] http://math.boisestate.edu/gas/patience/webop/pat16d.html



More information about the Python-list mailing list