Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
[SOLVED]need help implementing timer&keylistener in Jython assignment
Hi Im new to Jython and my prof told me to implement a microwave interface using this program so Im kinda stuck with this assignment because of what I stated in OP. I defined a actionlistener for both timer and keylistener but they gave me TypeErrors.
event = KeyEventWorkaround.processKeyEvent(event)
if not event:
if event.keyCode == KeyEvent.VK_ESCAPE:
print "Does it work?"
delay = 1000
time = Timer(delay, my_timed_task) # i got error TypeError: javax.swing.Timer(): 2nd arg can't be coerced to java.awt.event.ActionListener
frame = JFrame("Hi")
frame.addKeyListener(keypressed)#i got error TypeError: addKeyListener(): 1st arg can't be coerced to java.awt.event.KeyListener#some
I look through other peoples' code similar to timer and keylistener but they are all implemented inside a class. I dont want to implement my whole program in a class because im already finished 80% of my assignment and I dont want to waste time redoing it just to be stuck at some point.