O'Reilly logo

Hello World! Second Edition: Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. A New Kind of Input—Events

Up until now, we have had very simple kinds of inputs for our programs. Either the user 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.

Events

If I asked you, “What’s an event?” in real life, you might say that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required