/
beginner004.py
30 lines (22 loc) · 1021 Bytes
/
beginner004.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import scene
class MyClass(scene.Scene):
def __init__(self):
# good place to define/initialize variables
# it's only called one time, when the Scene object is created
scene.Scene.__init__(self)
def setup(self):
# good place to define/initialize layers
# it's only called one time, before the draw method is called
pass
def draw(self):
scene.background(0,0,1) # 0,0,1 = blue
def touch_began(self,touch):
print('touch_began here x:{}, y:{}'.format(touch.location.x,touch.location.y))
def touch_moved(self,touch):
print('touch_moved there x:{}, y:{}'.format(touch.location.x,touch.location.y))
def touch_ended(self,touch):
print('touch_ended here x:{}, y:{}'.format(touch.location.x,touch.location.y))
print
scene.run(MyClass())
# Please touch your display 3 times very quick and then quit the script. What do you see?
# Touch and move your finger only one time. What do you see?