Hello I am trying to use the up down left right arrow keys to move an object
How ever it does not seem to work and I receive no error messages any ideas?
from System.Windows.Input import KeyEventHandler
velocity = 10
class Gui():
def __init__(self):
KeyEventHandler(self.KeyDown_Control)
................................
def KeyDown_Control(self, s, e):
if e.Key == Key.Right:
self.canvas.SetLeft(self.ship, self.canvas.GetLeft(self.ship) +
velocity)
elif e.Key == Key.Left:
self.canvas.SetLeft(self.ship, self.canvas.GetLeft(self.ship) -
velocity)
elif e.Key == Key.Up:
self.canvas.SetTop(self.ship, self.canvas.GetTop(self.ship) -
velocity)
elif e.Key == Key.Down:
self.canvas.SetTop(self.ship, self.canvas.GetTop(self.ship) +
velocity)
Cheers
and thank you
Andrew
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com