week 13 event driven programming Flashcards

1
Q

event

A

when something happens (ex: user clocks button)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

turtle events

A

t.onclick()
t.ondrag()
t.onrelease()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

screen events

A

s.onclick()
s.onkey()
s.ontimer()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

additional functions needed for screen events

A

s.listen()
s.mainloop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

onkey() call for screen event

A

s.onkey(up, “up”)

up is function that specifies instructions when the up key is clicked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

onclick() call for turtle event

A

t.onclick(whenPressed)

funciton whenPressed takes x, y coordinates as arguments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

why are global variables useful for turtle events?

A

the only parameters the function can take are x,y coordinates, anything else should be a global var

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

are turtles global variables?

A

yes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

steps for screen events

A

1) set up screen
2) set up events and specify functions
3) call listen() and mainloop() functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly