ANN: Thinking in Tkinter

GerritM gmuller at worldonline.nl
Thu Sep 12 22:20:37 CEST 2002


"Russell E. Owen" <owen at nospam.invalid> schreef in bericht
news:alqiue$1ejo$1 at nntp6.u.washington.edu...
<...snip...>
> True. It would help if the command callback sent an arguement that
> identified the widget (making it look a bit more like an event binding).
> In any event, it doesn't and command is unfortunately still the best way
> to handle button widgets.

In a recent thread it was pointed out that you can also bind to s function
of a specific object instance. Out of the top of my head:

Class A:
    def printarg( self, arg ):
        print arg

anA = a()
functionBoundToInstance = anA.printarg

functionBoundToInstance("Hello Python")

Hello Python

this would work also for widgets, command = aWidget.activate

Sorry didnot try it out yet :-)

regards Gerrit
--
www.extra.research.philips.com/natlab/sysarch/






More information about the Python-list mailing list