Movatterモバイル変換
[0]ホーム
Named code blockes
James_Althoff at i2.comJames_Althoff at i2.com
Tue Apr 24 15:29:46 EDT 2001
D-Man writes:I think the registering of a callback is a nicer way of achieving theresults, but that is just my preference.-D<jim response>Mine too. I use JPython/Jython extensively with Swing. Normally Iwould have to use the Java mechanism of creating a class for eachhandler and then pass a single instance of the class in as theargument to a handler registration method. And since Pythondoes not support unnamed/"in place" classes this would be a painsince I would have to create "dummy named" event handler classes allover the place (each with one instance). However, the JPython/Jythonimplementation has a wonderful feature whereby you can assigna Python object to any Swing "property". In particular, you can designatea Swing event handler to be a Python callback method (just like in yourexample). This very nice feature is much loved and extensivley usedby our programming team here at work.(It makes it all worthwhile!)</jim response>
More information about the Python-listmailing list
[8]ページ先頭