January 31st, 2013, 01:44 AM
Join Date: Jan 2013
Time spent in forums: 42 m 38 sec
Reputation Power: 0
New to Python - "picture is not defined" error
I just started learning Python a few weeks ago so I'm guessing there's something very simple here that I'm missing. I'm trying to draw a ring (circle with white circle over it). I'm using an external python file called stddraw to make the shapes and what not.
from stddraw import *
def ring(picture, x, y, radius, width, color):
picture.filledCircle(x, y, radius, color)
picture.filledCircle(x, y, radius - width, 'white')
picture = Picture()
color = picture.randomColor()
ring(picture, .5, .5, .3, .2, color)
My professor is using the testRing function to see if it works, which it does. However, when I try to run the function using my own parameters, it returns this error "picture is not defined". It's been driving me crazy; thanks in advance. Apologies if this doesn't belong here-new to the site.