Skip to Content
Object-Oriented Python
book

Object-Oriented Python

by Irv Kalb
January 2022
Beginner to intermediate
416 pages
10h 21m
English
No Starch Press
Content preview from Object-Oriented Python

6 Object-Oriented Pygame

In this chapter I’ll demonstrate how you can use OOP techniques effectively within the pygame framework. We’ll start off with an example of procedural code, then split that code into a single class and some main code that calls the methods of that class. After that, we’ll build two classes, SimpleButton and SimpleText, that implement basic user interface widgets: a button and a field for displaying text. I’ll also introduce the concept of a callback.

Building the Screensaver Ball with OOP Pygame

In Chapter 5, we created an old-school screensaver where a ball bounced around inside a window (Listing 5-6, if you need ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Object-Oriented Programming - Fourth Edition

Python Object-Oriented Programming - Fourth Edition

Steven F. Lott, Dusty Phillips
Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel
Robust Python

Robust Python

Patrick Viafore

Publisher Resources

ISBN: 9781098129842Errata Page