Tkinter(newbie) Inside Pythonwin

Stephen Kloder stephenk at
Wed Sep 27 21:10:45 CEST 2000

Kragen Sitaker wrote:

> >   def say_hi(self):
> >       print "hi there, everyone!"
> This is a perfect example of why generalized lambda would be a useful
> thing.  There's no need to put say_hi in a separate function; callbacks
> from GUI objects can usually more conveniently be simple anonymous
> blocks of code than named functions.  I'd like to be able to say
> self.hi_there = Button(frame, text="Hello",
>                        command=lambda: print "hi there, everyone!")
> instead.  Which is what I do in Tcl:

Maybe we just need a progn type function (I'm thinking Lisp here):
self.hi_there.configure(command=progn:(counter=couter+1,print "Hi There!"))

Where the syntax would be along the lines of progn <parameter-tuple> :
Or even progn(command-sequence) and be called inside a lambda.

> and Perl, although bizarrely I don't have Perl's Tk interface installed
> at the moment, so I can't confidently post syntax, but it's something
> like -command => sub { print "hi there, everyone!\n" }.

That's pretty much it.
More completely:
$hi_there->configure(-command => sub { print "hi there, everyone!\n" });

Stephen Kloder               |   "I say what it occurs to me to say.
stephenk at       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.

More information about the Python-list mailing list