From: Kent J. <ke...@td...> - 2004-11-09 13:57:36
|
Colbert Philippe wrote: > Questions: > - Can we implement interface directly in Jython? If yes, how (example)? If you mean, can I write a Jython class that implements a Java interface? then yes, this is commonly done. Just import the Java interface and list it as a base class to your class. For example: from java.awt.event import MouseListener, MouseMotionListener class TreeMouseListener(MouseListener, MouseMotionListener): def mousePressed(self, event): ... > - Can we embed a Jython script in a way that the script can be called > several times and keep its environment? You can preserve the environment yourself between uses. I think that if you create a PyDictionary and pass it to each interpreter instance they will all share the same namespace. Or maybe you can just reuse the same interpreter for each use of the script. Kent |