Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66873 > unrolled thread

Re: Function and turtle help

Started byScott W Dunning <swdunning@cox.net>
First post2014-02-21 20:38 -0700
Last post2014-02-21 20:38 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Function and turtle help Scott W Dunning <swdunning@cox.net> - 2014-02-21 20:38 -0700

#66873 — Re: Function and turtle help

FromScott W Dunning <swdunning@cox.net>
Date2014-02-21 20:38 -0700
SubjectRe: Function and turtle help
Message-ID<mailman.7251.1393041974.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On Feb 21, 2014, at 7:13 PM, Dave Angel <davea@davea.name> wrote:

> Scott W Dunning <swdunning@cox.net> Wrote in message:
>> 
>> On Feb 20, 2014, at 11:30 PM, Dave Angel <davea@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.

Yes I just learned a little bit about functions a couple days ago in school.  I am completely new to programming so thanks for any help!

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

Ok I see.  

I changed it a little based on what you suggested and I got a change, the outline became red but the fill is still black.  Can you walk me through where I’m going wrong on what I have below?  

From what I gather, I have a function called fillcolor with a parameter called color.  I know this is going to sound stupid but I get a little lost after that.  The function says when ever I call fillcolor do what’s in the body?  What exactly does the parameter do (in this case color, how is that doing anything) and what is an argument?  

def fillcolor(color):    <- Function with parameter, right?
    pencolor(color)     <- Says make pencolor whatever I state when I call fill color, right?  	
    begin_fill()	      <- starts filling the star.  When I put color in () though I get an error that it takes no arguments?
    star(500)	      <- Star function 
    end_fill()	      <- Ends fill

red = "red"
fillcolor(red)


I know that I know absolutely nothing but I’m trying and I just started so please bare with me.  And thanks for any help, it's GREATLY appreciated!!

Scott


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web