-
Notifications
You must be signed in to change notification settings - Fork 0
/
draw_handler.py
57 lines (45 loc) · 1.14 KB
/
draw_handler.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<<<<<<< HEAD
# first example of drawing on the canvas
import simplegui
count=0
pos_x=100
pos_y=100
size_x=300
size_y=200
count=size_x
# define draw handler
def draw(canvas):
global count, pos_x,pos_y,size_x,size_y
count-=1
pos_x = size_x - (count % size_x)
canvas.draw_text("Hello!",[pos_x, pos_y], 24, "White")
canvas.draw_circle([100, 100], 2, 2, "Red")
# create frame
frame = simplegui.create_frame("Text drawing", size_x,size_y)
# register draw handler
frame.set_draw_handler(draw)
# start frame
frame.start()
=======
# first example of drawing on the canvas
import simplegui
count=0
pos_x=100
pos_y=100
size_x=300
size_y=200
count=size_x
# define draw handler
def draw(canvas):
global count, pos_x,pos_y,size_x,size_y
count-=1
pos_x = size_x - (count % size_x)
canvas.draw_text("Hello!",[pos_x, pos_y], 24, "White")
canvas.draw_circle([100, 100], 2, 2, "Red")
# create frame
frame = simplegui.create_frame("Text drawing", size_x,size_y)
# register draw handler
frame.set_draw_handler(draw)
# start frame
frame.start()
>>>>>>> e55f97114d0da06a25cf60393f67b0e16521bd92