Ive been a fan of No Starch Press books for years, and Im thrilled to have them publish my first book. Id like to thank everybody there, in particular my editors, Jill Franklin and Annie Choi, for their invaluable feedback and direction. Thanks to Paddy Gaunt, the technical reviewer, for checking over all my code and offering some excellent suggestions to improve it.
Additionally, Id like to thank the creators, maintainers, and community surrounding Processing and its related projects, and also the developers of the Python programming language. Youve inspired my students and me, and its a privilege to share your hard work with everybody who reads this book.
Introduction
When I first encountered programming code, I stared, amazed and bewildered, at a screen of obscure commands and symbols and wondered how anybody could understand it, let alone write it. Id hit the F5 key, and the program would magically spawn a cityscape in which two players, depicted as gorillas, could hurl explosive bananas at each other. I tried changing a few lines to see what would happen, and on occasion, it was something predictable or cool. More often than not, the game would simply fail to run. In a futile attempt to be helpful, the computer would diagnose my errors, rambling on about syntax and illegal operations of varying description.
For some years thereafter, I was content to avoid learning to program. That began to change when I became interested in making my creative work more interactive. You may already have encountered a few of the same barriers that frustrated me. Maybe you were getting by just fine with visual tools but then hit a wall. Or to your disappointment (and horror?), you discovered that what you sought to accomplish required delving into code.
Software applications, with all of their graphical widgets, make us feel like were in control. The illusion, however, soon fades when you discover that the tool you desire is missing. Through learning to program, you gain a true mastery of your computer.
Who Is This Book For?
This book assumes no prior programming experience. It strives to make the process of learning to program as visual and entertaining as possible. The content is based on my extensive experience teaching first-time coders, designers, and interactive media students. The skills and knowledge youll gain are fundamental to programming for an ever-expanding horizon of creative technologies, such as games, the web, augmented/virtual reality, and even visual effects for films.
If youre an artist, student, designer, researcher, or just somebody keen on picking up coding skills, Python Mode for Processing is excellent for learning to program in a visual context.
For anybody with prior programming experience, this book would be useful for learning Python, Python Mode for Processing, or creative coding techniques.
You may have experience with another visual programming languagesomething like Scratch, where you connect together graphical elements like boxes, icons, and arrows. Python is not such a languagerather, it is a textual programming language that requires you to type code. To make learning visual, though, youll focus on writing code that produces drawings, patterns, animations, data visualizations, user interfaces, and simulations. This approach not only makes for cool-looking graphics, but also helps you visualize the underlying concepts of programming.
What Is Python Mode for Processing?
Python Mode for Processing combines the Python programming language and Processing, a development environment for interactive and graphics programming. Youll also see Python Mode for Processing referred to as Processing.py. The project started as a command line tool named Processing.py, but its developer decided to label it Python Mode when it was made available for the Processing development environment. In this book, you can consider the terms largely interchangeable.
Python is one of the most popular programming languages in use today. There are many good reasons for this, but heres why you should care. First, Python is a beginner-friendly language. Its more approachable than languages like Java or C++, so youll find it easier to read, write, and understand. Second, its a general-purpose language, suitable for programming artificial intelligence (AI), games, simulations, web applications, and just about everything in between.