Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 18. A New Kind of Input—Events

Chapter 18. A New Kind of Input—Events

Up until now, we have had very simple kinds of inputs for our programs. The user either typed in strings using raw_input(), or we got numbers and strings from EasyGui (in chapter 6). I also showed you how you could use the mouse to close a Pygame window, but I didn’t really explain how that worked.

In this chapter, you’ll learn about a different kind of input called events. Along the way, we’ll look at exactly what the exit code for the Pygame window is doing and how it works. We’ll also get input from the mouse and make our programs react immediately to a key being pressed, without having to wait for the user to press Enter.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint