From: Slinger, Neil <neil_slinger@me...> - 2002-07-19 14:31:24
I have just started using Jython and have come stuck on a certain issue.
I am calling a function when a button is pressed. e.g.
button = swing.JButton("Hello", actionPerformed=buttonPressed)
This works fine obviously, however, I need to be able to send a string to
the 'buttonPressed' function. Here is an example to show what I mean.
def buttonPressed(event, text):
text = "Hello"
button = swing.JButton("Hello", actionPerformed=buttonPressed(text))
This appears not to work, as it requires 2 arguments. If I remove the
required 'event' argument it doesn't wait until the button has been pressed
before going to 'buttonPressed'.
Can you please help me, pass the string to the 'buttonPressed' function?
I would appreciate a prompt response as I need to get this working ASAP.
Junior Software Development Engineer
Mentor Graphics Corp
Mobile: 07740 364402