January 31st, 2013, 01: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, 10: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, 11:40 AM
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: openSUSE 13.1 (home desktop, home laptop), Crunchbang Linux 11 (work laptop), Trisquel GNU/Linux 6.0.1 (mini laptop), Ubuntu 14.04 LTS (server), Android 4.2.1 (tablet), Windows 7 Ultimate (testbed)