Skip to content

Utilities for drawing in cs1graphics: Draws a grid, marks reference points, and shows coords on clicks

Notifications You must be signed in to change notification settings

wellesleycs111/cs1graphicsHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cs1graphicsHelper.py

Screenshot of cs1graphicshelper

This script includes 3 helper functions which will make drawing in cs1graphics easier:

  1. drawReferencePoints(canvas): Marks the reference point of any objects on the canvas with a small orange circle; Layers have a small x inside the circle.
  2. drawGrid(canvas, dimension): Draws a labeled grid on the canvas to help pick coordinate points. Param dimension indicates the spacing of the grid; defaults to 100.
  3. markClicks(canvas): Prints the coordinates of every mouse click; can slow things down, so toggle it on/off as needed.

Instructions

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.

About

Utilities for drawing in cs1graphics: Draws a grid, marks reference points, and shows coords on clicks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages