# 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 change the default color (and thus set the color of primatives). # Default color when Quickdraw starts is white. # 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 filled circle: default color is white quickdraw.stdin.write("fillcircle 0 0 100") quickdraw.stdin.write("\n") # Change default color (remember the order is red level, green level, blue level) to blue quickdraw.stdin.write("color 0 0 255") quickdraw.stdin.write("\n") # Draw a filled circle: default color is now a strong blue quickdraw.stdin.write("fillcircle 100 100 50") quickdraw.stdin.write("\n") # Change default color (remember the order is red level, green level, blue level) to green quickdraw.stdin.write("color 0 255 0") quickdraw.stdin.write("\n") # Draw a filled circle: default color is now a strong green quickdraw.stdin.write("fillcircle 200 200 10") quickdraw.stdin.write("\n") # Change default color (remember the order is red level, green level, blue level) to red quickdraw.stdin.write("color 255 0 0") quickdraw.stdin.write("\n") # Draw a filled circle: default color is now a strong red quickdraw.stdin.write("fillcircle 200 200 5") quickdraw.stdin.write("\n")