Example 4: Python And Networking - Raspberry Pi User Manual

Hide thumbs Also See for Raspberry Pi:
Table of Contents

Advertisement

C H A P T E R 1 1
run it either by using IDLE's Run Module option in the Run menu or from the terminal by
typing
python raspberrysnake.py
Figure 11-6), so make sure you're ready!
A full copy of the program listing for Raspberry Snake is included in Appendix A, "Python
Recipes", and on the Raspberry Pi User Guide website at
raspberrypiuserguide
some typing, but entering the code by hand is a good way of ensuring that you understand
what each section does . In addition to the functions used in Raspberry Snake, pygame pro-
vides lots of features not used in this program, including audio playback, sprite handling for
better graphics and mouse control . The best place to learn about pygame's more-advanced
functions is on the official website,
you can download tutorials and example programs to get a handle on how things work .

Example 4: Python and Networking

So far, you have learned how Python can be used to create standalone programs, but the
language can also be used to create programs that communicate with the outside world over
a computer's network connection . This next example, written by Tom Hudson, offers a brief
glimpse of these possibilities with a tool for monitoring the users connected to an Internet
Relay Chat (IRC) channel .
A N I N T R O D U C T I O N T O P Y T H O N
. The game will start as soon as it has loaded (see
. Downloading the source code from the website will save you
http://www.pygame.org/wiki/tutorials
http://www.wiley.com/go/
171
Figure 11-6:
Playing
Raspberry Snake
on the
Raspberry Pi
, where

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents