summaryrefslogtreecommitdiff
path: root/src/samples/event2.py
blob: 6e7de6345fa87817d31eb61ed2ccec1a073beef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from libavg import avg, player

def onDiv(event):
    words.color = "FF8000"

def onWords(event):
    words.color = "00FF00"

canvas = player.createMainCanvas(size=(640,480))
rootNode = canvas.getRootNode()
words = avg.WordsNode(pos=(10,10), text="Should I stay or should I go?", 
        parent=rootNode)
div = avg.DivNode(pos=(100,0), size=(80,200), parent=rootNode)
words.subscribe(words.CURSOR_MOTION, onWords)
div.subscribe(div.CURSOR_MOTION, onDiv)

player.play()