Activity 3: Challenge: Design new elements

Workshop Resources

Using loops, you can actually design your own elements on the colorboard. You can design your own logo or anything you want on this color board. Here is an example we provided for you.

Example: make an N.

#This creates the original colorboard.
from PIL import Image
img = Image.new('RGB', (60, 30), 'white')

#This uses nested while loop to change the colorboard.
#Left vertical line
for x in range(10, 15):
  for y in range(5, 25):
    img.putpixel( (x,y), (0, 0, 0))

#Right vertical line
for x in range(30, 35):
  for y in range(5, 25):
    img.putpixel( (x,y), (0, 0, 0))

#Central diagonal line
for y in range(5, 25):
  for x in range(10+(y-5), 15+(y-5)):
    img.putpixel( (x,y), (255, 211, 0)) 
img.save('pixel-activity3.png')

output: alt text

Design your own element!

You can actually design some easy letters, such as H, K, T and etc. You can change the color of a certain part of those letters in order to make it prettier.