Jython: Setting up a Popup Menu dynamically

Well, I know this doesn’t exactly help you now, but in 7.6 you’ll be able to do something like this:

from functools import partial

def f1(event):
	print 'f1(event=%s)' % str(event)
	
def f2(event):
	print 'f2(event=%s)' % str(event)

def f3(event, param):
	print 'f3(event=%s, param=%s)' % (str(event), str(param))
	 
	 
f3_partial = partial(f3, param='some value')

menu = system.gui.createPopupMenu({
	'item1' : f1, 
	'item2' : f2, 
	'item3' : f3_partial})
	
menu.show(event)

This is valid Jython code in 7.5 as well, but because of some internal scripting details it won’t work for this particular case.