Learn Python Visually: Creative Coding with Processing.py

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This beginners book introduces non-programmers to the fundamentals of computer coding within a visual, arts-focused context. Tristan Bunn’s remarkably effective teaching approach is designed to help you visualize core programming concepts while you make cool pictures, animations, and simulations using Python Mode for the open-source Processing development environment. Right from the first chapter, you'll produce and manipulate colorful drawings, shapes and patterns as Bunn walks you through a series of easy-to-follow graphical coding projects that grow increasingly complex. You’ll go from drawing with code to animating a bouncing DVD screensaver and practicing data-visualization techniques. Along the way, you’ll encounter creative-yet-practical skill-building challenges that relate to everything from video games, cars, and coffee, to fine art, amoebas, and Pink Floyd. As you grow more fluent in both Python and programming in general, topics shift toward the mastery of algorithmic thinking, as you explore periodic motion, Lissajous curves, and using classes to create objects. You’ll learn about: • Basic coding theories and concepts, like variables, data types, pixel coordinates, control flow and algorithms • Writing code that produces drawings, patterns, animations, data visualizations, user interfaces, and simulations • Using conditional statements, iteration, randomness, lists and dictionaries • Defining functions, reducing repetition, and making your code more modular • How to write classes, and create objects to structure code more efficiently In addition to giving you a good grounding in general programming, the skills and knowledge you’ll gain in this book are your entry point to coding for an ever-expanding horizon of creative technologies.

Author(s): Tristan Bunn
Edition: 1
Publisher: No Starch Press
Year: 2021

Language: English
Commentary: Vector PDF
Pages: 296
City: San Francisco, CA
Tags: Programming; Python; Graphics; Object-Oriented Programming; Drawings; Elementary; 2D Graphics; 3D Graphics; Processing

About the Author
About the Tech Reviewer
Acknowledgments
Introduction
Who Is This Book For?
What Is Python Mode for Processing?
What Are Algorithms?
What Is Creative Coding?
Where Can I Find Help?
Online Resources
Source Code and Solutions
What’s in This Book?
Let’s Go!
Chapter 1: Hello, World!
Processing Installation and Python Mode Setup
Your First Sketch
Comments
Whitespace
Errors
Color
Fills and Strokes
Background Color
Color Modes
2D Primitives
triangle()
ellipse()
quad()
line()
Challenge #1: Rainbow Task
Variables
Arithmetic Operators
Basic Operations
Modulo Operator
Arcs
Challenge #2: Disk Usage Analyzer
Summary
Chapter 2: Drawing More Complicated Shapes
Displaying a Grid
Drawing Curves Using Catmull-Rom Splines
Curving Lines with curve()
Changing Curves with curveTightness()
Drawing Bézier Curves
Using the bezier() Function
Positioning Anchor and Control Points
Drawing Shapes Using Vertices
Bézier Vertices
Using Vector Graphics Software for Generating Shapes
Summary
Chapter 3: Introduction to Strings and Working with Text
Strings
Creating Strings in Python
Using Concatenation and String Formatting
Working with String Length
String Manipulation
Slice Notation
String Methods
Typography
Fonts
Text Functions
Summary
Chapter 4: Conditional Statements
Control Flow
Conditional Statements
The Boolean Data Type
Relational Operators
if Statements
elif Statements
else Statements
Logical Operators
Challenge #3: Four-Square Task
Summary
Chapter 5: Iteration and Randomness
Iteration
Using Iteration to Draw Concentric Circles
while Loops
for Loops
Challenge #4: Create Line Patterns
break and continue Statements
Randomness
random() Function
Random Seed
Truchet Tiles
Summary
Chapter 6: Motion and Transformation
Perceiving Motion
Adding Motion to Processing Sketches
The draw() and setup() Functions
Global Variables
Saving Frames
Challenge #5: DVD Screensaver
Transformations
Processing Transformation Functions
translate()
rotate()
scale()
shearX() and shearY()
pushMatrix() and popMatrix()
Challenge #6: Analog Clock
Summary
Chapter 7: Working with Lists and Reading Data
Introducing Lists
Creating and Accessing Lists
Modifying Lists
Combining Loops and Lists
Drawing Shapes by Using a List of Color Values
Looping with enumerate()
Creating Lists of Lists
Challenge #7: Breakout Level
Reading Data
File Formats
CSV
Challenge #8: Games Sales Chart
Summary
Chapter 8: Dictionaries and JSON
Introducing Dictionaries
Accessing Dictionaries
Modifying Dictionaries
Nesting Dictionaries and Lists
Combining Loops and Dictionaries
Iterating Keys
Iterating Values
Iterating Items
Working with JSON
Understanding JSON Syntax
Using Web APIs
Reading in JSON Data
Challenge #9: Coffee Chart
Summary
Chapter 9: Functions and Periodic Motion
Defining Functions
Creating a Simple Speech Bubble Function
Drawing Compound Shapes Using a Function
Adding Arguments and Parameters
Using Keyword Arguments
Setting Default Values
Mixing Positional and Keyword Arguments
Returning Values
Defining Functions for Periodic Motion
An Introduction to Trigonometric Functions
Circular and Elliptical Motion
Sine Waves
Lissajous Curves
Creating Screensaver-Like Patterns with Lissajous Curves
Summary
Chapter 10: Object-Oriented Programming and PVector
Working with Classes
Defining a New Class
Creating an Instance from a Class
Adding Attributes to a Class
Adding Methods to a Class
Programming Movement with Vectors
The PVector Class
Moving an Amoeba with PVector
Adding Many Amoebas to the Simulation
Splitting Your Python Code into Multiple Files
Challenge #10: Collision Detection
Summary
Chapter 11: Mouse and Keyboard Interaction
Mouse Interaction
Mouse Variables
Mouse Events
Creating a Paint App
Keyboard Interaction
Adding Keyboard Shortcuts to the Paint App
Challenge #11: Adding Paint App Features
Summary
Afterword
More Python for Processing
More Python
Other Creative Coding Environments
INDEX