# This program was based on the assignment description provided by Nathaly Verwaal in the fourth assignment import subprocess # JT: This program just assumes that the quickdraw.zip file is in the current working directory. # JT: Also note that how this subprocess (how your Python program communicates with QuickDraw) is created. # JT: Normally the second argument stdin etc. allows your program to pass information to QuickDraw # JT: For A4 you need a 3rd argument that allows you read information about mouse events *from* QuickDraw quickdraw = subprocess.Popen(['java', '-jar', './quickdraw.zip'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) # JT: turns on the ability to 'listen' (receive info about) mouse events quickdraw.stdin.write('mouseclick True\n') # JT: mouse events come back in the form of a string, this string is stored in the variable event event = quickdraw.stdout.readline() # JT: Display this string to see what information QuickDraw provides about the event and in what # JT: format it comes. print event