9BUILDING OBJECTS WITH CLASSES

Old teachers never die, they just lose their class.—Anonymous

image

Now that you’ve created cool graphics using functions and other code in Processing, you can supercharge your creativity using classes. A class is a structure that lets you create new types of objects. The object types (usually just called objects) can have properties, which are variables, and methods, which are functions. There are times you want to draw multiple objects using Python, but drawing lots of them would be way too much work. Classes make drawing several objects with the same properties easy, but they require a specific syntax you’ll need to ...

Get Math Adventures with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.