A variation on the Stars and Stripes American Flag for Independence Day. It’s an exercise in the use of transparency in Pygame. The stripes are made transparent so the stars image behind shows through.…

Rainbow Flag in Pygame
This little Pygame program paints the Rainbow Flag, as used by the LGBT movement. It illustrates:
- Importing the Pygame library
- RGB colours in hexadecimal
- Python’s for loop using the enumerate() function
- Filling a rectangular area in Pygame
- Updating display

A Fake Circle made of Straight Lines
Inspired by this post on Reddit, I wrote this little script to do the same thing. The circle is an illusion created by 100 straight-line tangents to an invisible circle. The tangents are created by drawing a chord in a …

Easy Graph Plotting with Pyplot
Graphs (also known as charts) are an indispensible visual aid for conveying a lot of data in an easy-to-digest form. Everyone is familiar with graphs in everyday life, such as those showing trends over time, e.g. world population, global …

Square Spiral
This is a very simple introduction to Turtle graphics. The turtle starts in the middle of the window, moves forward a small distance, turns right, moves forward a slightly longer distance, right again, even further this time… until the distance …