[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[ease-dev] Button Keylistener Python
|
Hi *,
does anyone know, how I can add a key listener to a button within a
Python EASE Script. I tried following, but I get following error.
Code:
---------------------------------------------------------------------------------------
# name : Keylistener Example
loadModule('/System/UI Builder')
def callback():
print('Button clicked')
class MyKeyListener(org.eclipse.swt.events.KeyListener):
def keyPressed(self, event):
print("Key pressed:", event.character)
def keyReleased(self, event):
print("Key released:", event.character)
createView('Example')
button = createButton('DoIt', callback)
button.addKeyListener(MyKeyListener())
---------------------------------------------------------------------------------------
Error:
---------------------------------------------------------------------------------------
org.eclipse.ease.ScriptExecutionException: Traceback (most recent call last):
File "workspace://ease/working/keylistener_example.py", line 9, in <module>
# Jonah Graham (Kichwa Coders) - initial API and implementation
TypeError: JavaClass.__init__() takes 3 positional arguments but 4 were given
---------------------------------------------------------------------------------------
Maybe someone has an idea what I do wrong...
BR,
Raphael