Creative Programming: drawing with py5

Combinations and permutations with Processing and Python

How many pairs of colors can we choose from a palette of 8 colors? What are the possible ways to combine 3 distinct geometric shapes and some pairs of colors? To produce images, which explore these and other questions, we will use py5, a programming tool that allows you to use the vocabulary and graphics infrastructure of Processing in conjunction with the latest version of the Python language.

What will you learn?

First, we'll see how to draw some geometric shapes with py5, learn how to indicate fill colors, and some other settings of the graphics attributes. Then, we'll study some basic Python data structures, and how to use them to produce drawings with many elements. Next, we'll experiment with how to produce all possible combinations and permutations of some elements. Finally, we'll draw examples of these graphical element configurations in an ordered fashion.


Recommended for anyone who has had initial contact with creative programming or with programming in general. The tools we will use are open and free, the text editor for code Thonny IDE (, the Python programming language, and the py5 library (, which brings the drawing vocabulary.

Step-by-step instructions for installing the tools are at

  • 132 STUDENTS
  • AUDIO: Portuguese
  • SUBTITLES: English

Alexandre B A Villares

Educator, visual artist and new media consultant. Researches computational art procedures, generative design, creative coding and how to teach computer programming in a visual context. Architect (FAU-USP, 2000) with a master’s degree from FECFAU-Unicamp (2019). Co-organizer of Noite de Processing and Processing Community Day in São Paulo / Brazil. Holds teaching positions in several educational instituions and also acts as an independent isntructor.