From: Kieran B. <ki...@br...> - 2001-06-06 16:55:08
|
Thanks Tessa. I perhaps gave a bad example of the problem I was having. What about this: >> from javax.swing import * >> def foo(e): >> print "foo" >>> f = JFrame(windowListener=foo) Traceback (innermost last): File "<console>", line 1, in ? TypeError: can't convert <function foo at 6767586> to java.awt.event.WindowListener Tessa Lau wrote: >See the documentation on Java Bean properties in the Jython docs: > http://www.jython.org/docs/properties.html > >The Pythonesque way to do it is by putting your event handling code >into a method, and setting the event property on the widget itself: > > def handleChange(event): > # whatever > > tf = TextField(textValueChanged=handleChange) > >--Tessa > > |