January 31st, 2013, 02:44 AM
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.
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.
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)
January 31st, 2013, 11:36 AM
Your question is reasonable, this forum is good.
Since I know nothing at all about stddraw I cannot answer your question.
Nor did you post the error message verbatim. You're new to python and might be insensitive to python case sensitivity. When you write "picture is not defined" I suspect you actually mean "Picture is not defined."
We need to know how to find stddraw.
We need to see the whole error message.
Or I may have overlooked something.
Most likely you don't have stddraw installed on your computer.
[/code] are essential for python code and Makefiles!
January 31st, 2013, 12:40 PM
A brief googling seems to indicate stddraw is a private teaching (?) project of someone who’s quite possibly basoon27’s professor. A (TeX-made) document can be publicly found but not the module itself.
Originally Posted by b49P23TIvg
Comments on this post
My armada: Debian GNU/Linux 8 (desktop, server, work laptop), Linux Mint 17.2 KDE (home laptop), Ubuntu 14.04.3 LTS (HTPC), Android 4.2.1 (tablet)