# The instruction for creating a subprocess to communicate with the Quickdraw library # was provided by Nathaly Verwaal. # Author: James Tam # Version: September 23, 2010 # This program illustrates how to draw some primitives by determining their (x,y) coordinates # in the drawing area as well as how to set some of the physical properties (size). # Reminder: to run this program you need Quickdraw to be in the same directory or folder # as this program. Also double check if the suffix for Quickdraw ends with ".zip" or ".jar". import subprocess quickdraw = subprocess.Popen(['java', '-jar', './quickdraw.zip'], stdin = subprocess.PIPE) # Draw a circle: center at (x,y) = (0,0), radius = 100 pixels quickdraw.stdin.write("circle 0 0 100") quickdraw.stdin.write("\n") # Draw a circle: center at (x,y) = (100,200), radius = 50 pixels quickdraw.stdin.write("circle 100 200 50") quickdraw.stdin.write("\n") # Draw a filled rectangle: top left corner (x,y) = (200,200) width = 50 pixels, height = 200 pixels quickdraw.stdin.write("fillrect 200 200 50 200") quickdraw.stdin.write("\n")