Function and turtle help

Dave Angel davea at davea.name
Fri Feb 21 21:13:26 EST 2014


 Scott W Dunning <swdunning at cox.net> Wrote in message:
> 
> On Feb 20, 2014, at 11:30 PM, Dave Angel <davea at davea.name> wrote:
> 
>> Look at turtle.begin_fill and turtle.end_fill
>> 
>> That's after making sure your star is a closed shape.
> 
> 
> 
> So, this is what I have so far and it “works” but, it fills in the star with black and as you can see below I am trying to fill it in with red.  So I’m obviously messing up somewhere.  
> 
> def fillcolor(red):
>     pencolor()
>     begin_fill()
>     star(500)
>     end_fill()
> 
> red = pencolor
> fillcolor(red)
> 

You seem to have a fundamental misunderstanding of how variables
 and function parameters work.

> def fillcolor(red):
   The parameter should be something like color, not red.

>     pencolor()
    You need an argument to this function if you expect it to
 change the color.  I suggest color, the parameter we just
 renamed.

> red = pencolor

That does nothing at all useful for you.  I expect you really want
       red = "red"


-- 
DaveA




More information about the Python-list mailing list