Jamie Starke bio photo

Jamie Starke

I develop for my career, but I also develop for fun, and whenever I think it can solve a problem I'm having. This has lead me to create side projects, such as Rental Map and BusTimes, among others.

Newsletter Email Twitter Facebook Google+ LinkedIn Github Stackoverflow More

Chris Luce gave a good example to help show the basic concepts needed to get started on assignment 1. This example is available Here.

One of the most important things in the assignment is that the user must be able to define where on screen the happy face will show up. A few important things to not on this.

To ask the user for where they would like the happy face, you must first use this command at the very beginning of your program.

import sys

This allows you to use premade stuff in python. Now to be able to send write a question to the user like “Enter an x value: “, you would use

sys.stderr.write("enter an x value: ")

This effectively bypasses QuickDraw, and writes this directly to the terminal.

Now, to get the input from the user you can use

x = input()

If we now wanted to place a circle at the x value provided by the user, we could how use.

print "circle", x, "300 50"

In this example, the circle’s horizontal placement would be set by the user, and the vertical would be in the middle of the window.

For a more specific example, check out Chris Luce’s example Here.

If you have any questions, consult the extra help page