From: Mark E. <m.e...@ad...> - 2002-07-19 19:47:39
|
Oops. Yet another cut and paste error. Thanks. Mark -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of Samuele Pedroni Sent: Friday, July 19, 2002 10:24 AM To: Mark Elston; Jython-Users Subject: Re: [Jython-users] URGENT: Jython actionPerformed help!! (please...) > Note: > > I haven't tried this in practice but this should work. Define a closure. > > def handlerGen(text): > def theHandler(event): > print text > return theHandler > > text = "Hello" > button = swing.JButton("Hello", actionPerformed=buttonPressed(text)) > s/buttonPressed/handlerGen yup, but with 2.1 you need also first a from __future__ import nested_scopes regards. |