Hero image

Random Rectangles

What the code does

Draws a large number of rectangles with random aspect ratios and random colours at random positions on the screen. Note that PTB elegently deals with cases where part of the rectangle would appear off of the screen due to its dimensions and positioning. The part of the rectangle off of the screen is simple not drawn, so the code does not crash.

Visualisation

The code

Instagram image Instagram image Instagram image Instagram image Instagram image Instagram image