Sample Chapter

FREE Sample – Chapter 4 – Creating Games and Graphics

Packt Publishing have made available Chapter 4 of the book available FREE to download:

On the “Sample Chapters” tab, simply click on “download sample chapters in PDF format” link to download and view it.


Chapter contents

This chapter explains how to create a drawing application and graphical games using the Tkinter Canvas.

Using IDLE3 to debug your programs

Debugging using Idle

Drawing lines using a mouse on a Tkinter Canvas

Drawing on the Tkinter canvas

Creating a bat and ball game

Bat and Ball game

Creating an overhead scrolling game

Overhead scrolling game

Supporting files

The final example “Creating an overhead scrolling game” uses several images as sprites, which you will need in order to run the program.

To download the image files used in the sample chapter directly on your Raspberry Pi use the following command:


Alternatively, you can download the files directly here.


Just ensure that when you run your script, the following files are in the same directory.

bg.gif, gold.gif, mark.gif, playerD.gif, playerL.gif, playerR.gif, playerU.gif, wallH.gif, wallV.gif


You can also download the full code files for the book by selecting the “Support” tab and selecting “Download Files“.  You will need to register your email address and you should receive a direct link to the file.


Any questions or comments, then feel free to let me know.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s