#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep 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.

    Code:
    from stddraw import *
    
    def ring(picture, x, y, radius, width, color):
            picture.filledCircle(x, y, radius, color)
            picture.filledCircle(x, y, radius - width, 'white')
    
    def testRing():
        picture = Picture()
        color = picture.randomColor()
        ring(picture, .5, .5, .3, .2, color)
        picture.start()
    
    testRing()
    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.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,841
    Rep Power
    480
    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]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Joensuu, Finland
    Posts
    431
    Rep Power
    67
    Originally Posted by b49P23TIvg
    We need to know how to find stddraw.
    A brief googling seems to indicate stddraw is a private teaching (?) project of someone whos quite possibly basoon27s professor. A (TeX-made) document can be publicly found but not the module itself.

    Comments on this post

    • Dietrich agrees : could be Tkinter based
    My armada: openSUSE 13.1 (home desktop, home laptop), Crunchbang Linux 11 (mini laptop, work laptop), Android 4.2.1 (tablet)

IMN logo majestic logo threadwatch logo seochat tools logo