Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2012-10-10 20:10:53 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-10-10 20:10:53 (GMT)
commitdc1cbc5c0a574a5cbca7543cbdbea5a45dde7232 (patch)
tree590a0334b9d580858b2ddca0fde30d401103766c
parent646dbd252787515222ad09943000ce02bdee1e2d (diff)
Add events
Signed-off-by: Cristhofer Travieso <cristhofert97@gmail.com>
-rwxr-xr-xgame.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/game.py b/game.py
index e5961c5..625c8df 100755
--- a/game.py
+++ b/game.py
@@ -9,16 +9,23 @@ class Game(glucosa.GameArea):
def __init__(self):
glucosa.GameArea.__init__(self)
- head = Head()
+ self.events = glucosa.Events(self)
+
+ head = Head(self.events)
self.add_sprite(head)
class Head(glucosa.Sprite):
- def __init__(self):
+ def __init__(self, events):
image = glucosa.Image('images/head.png')
glucosa.Sprite.__init__(self, image, 0, 0)
- pass
+ self.events = events
+
+ self.events.connect('key-press-event', self.key_pressed)
+
+ def key_pressed(self, widget):
+ print 'ok'
if __name__ == '__main__':
w = gtk.Window()