I have only spent a few hours with Jython but am
impressed with how quickly I have been able to develop
useful tools (impressed enough to have ordered Jython
Essentials). I have no python experience and have
only dabbled a little with java, but have managed to
create a number of useful tools already. I am now
trying to play with JTree objects and am having
trouble getting my head around working with events.
For example, I would like to popup a menu of actions
when the user right-clicks on a node. I have some
code (which I butchered from something I found in the
archives) which includes the following (i.e. there's
stuff before and after this, but I think this is the
def __init__(self, ChildName):
self.userObject = ChildName
def pressed(self, event):
print "Argh! You got me!"
rootnode = myNode("Root")
child1 = myNode("Child-1")
child2 = myNode("Child-2")
child1_1 = myNode("Grandchild 1-1")
This does not print when I press the mouse on a node.
I actually want a right-click anyway but thought I'd
have a go at that after getting some sort of response
from any kind of click. I have not been able to find
examples searching on the, and will have to wait a
month before I'll be in the same location as the
Jython Essentials I have just ordered. At the moment
that feels like a very long time :)
Can anyone post an example of how to popup a menu
after a right-click on a JTree node to get me going?
Data Services Manager
Adult Morbidity and Mortality Project (AMMP)
Box 65243, Dar es Salaam, Tanzania
Tel: +255 22 211 6145 Fax: +255 22 212 3289
Want to chat instantly with your online friends? Get the FREE Yahoo!
From: Diez B. Roggisch <deets@we...> - 2003-11-17 10:29:33
=2D----BEGIN PGP SIGNED MESSAGE-----
> Can anyone post an example of how to popup a menu
> after a right-click on a JTree node to get me going?
I don't have one at hand - but it might help to google for JTree-examples i=
java - you'll find plenty of these, and translating them to jython is usual=
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
=2D----END PGP SIGNATURE-----