-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAssignment4_1.py
More file actions
34 lines (29 loc) · 736 Bytes
/
Copy pathAssignment4_1.py
File metadata and controls
34 lines (29 loc) · 736 Bytes
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
'''
Created on May 17, 2015
A program which asks the user to enter a command like f for fire and q for quit
and if the user enter f it shoots a ball and shows how it drops down gradually.
@author: Likai
'''
import turtle
#trigger = input('Input \'f\' for fire and \'q\' for quit:')
V0 = 50
window = turtle.Screen()
#if trigger == 'f':
def f():
print('Boom!')
brad = turtle.Turtle()
brad.shape('circle')
brad.dot(20, 'red')
for t in range(10):
x = V0 * t
y = -0.5 * 10 * t **2
brad.goto(x, y)
brad.dot(1)
#elif trigger == 'q':f
def q():
window.bye()
print('The program has been terminated!')
window.onkey(f, 'f')
window.onkey(q, 'q')
window.listen()
turtle.done()