This script includes 3 helper functions which will make drawing in cs1graphics easier:
drawReferencePoints(canvas)
: Marks the reference point of any objects on the canvas with a small orange circle; Layers have a smallx
inside the circle.drawGrid(canvas, dimension)
: Draws a labeled grid on the canvas to help pick coordinate points. Paramdimension
indicates the spacing of the grid; defaults to 100.markClicks(canvas)
: Prints the coordinates of every mouse click; can slow things down, so toggle it on/off as needed.
Put cs1graphicsHelper.py in your working folder, then import after cs1graphics.
from cs1graphics import *
from cs1graphicsHelper import *
At the end of your script, invoke 1 or more of the helper functions on your canvas:
paper = Canvas(500, 500, 'yellow')
# [...CODE TO ADD SHAPES TO CANVAS HERE...]
drawReferencePoints(paper)
drawGrid(paper, 100)
markClicks(paper)
Run demo.py for a full demonstration.