Interaction

In the PyGame programs we have seen so far, the user could not affect their execution, aside from ending the program. We can compare this kind of programs to watching movies - the user is essentially a viewer.

In the next section, we will deal with programs in which the user has an active role and can influence the running of the program using a mouse and a keyboard. There are two basic ways for our program to “know” when the user has made an action.

In this chapter, we will familiarize with both of these ways that enable our programs to respond to user actions.