video drawing demo

This is the demo drawing.py that I did in the video.

Since I want to make an easily viewable "save as html" file from this, I changed .draw() to a messier alternative. The details are below.

Jim Mahoney | September 2020 | cs.bennington.college | MIT License

In [36]:
from drawing import *
from random import randint
In [37]:
picture = Drawing(400, 400)
picture.set_coords(0, 0,  10, 10)  # bottom,left,   top,right

for i in range(10):
    random_color = color_rgb(randint(0,255), randint(0,255), randint(0,255))
    picture.add( Line( Point(randint(1,9), randint(2,6)), 
                       Point(8, 3) , 
                       color=random_color
                     ) 
               )

picture.render()   # Create in memory but don't show it yet.
In [38]:
picture.display()  

# Display the picture and put it into the python notebook.
# This lets the image be part of the "save as html" file,
# which .draw() does not, but needs to be in a different cell,
# evaluated only after the image has been created.