Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66786
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <swdunning@cox.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.082 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'turtle': 0.07; 'subject:help': 0.08; 'subject:Function': 0.09; 'def': 0.12; '(just': 0.16; 'appreciated!': 0.16; 'star.': 0.16; 'subject:turtle': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'obviously': 0.18; 'trying': 0.19; 'received:10.0.1': 0.19; 'feb': 0.22; 'import': 0.22; 'math': 0.24; 'script': 0.25; 'class.': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'skip:( 20': 0.30; 'code': 0.31; 'piece': 0.31; 'allows': 0.31; 'trouble': 0.34; 'received:10.0': 0.36; 'so,': 0.37; 'received:10': 0.37; 'star': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'color': 0.61; 'matter': 0.61; 'times': 0.62; 'header :Message-Id:1': 0.63; 'charset:windows-1252': 0.65; 'american': 0.66; 'here': 0.66; '20,': 0.68; 'goal': 0.75; '2014,': 0.84; 'it\x92s': 0.84; 'red.': 0.84; 'scott': 0.93; 'ultimate': 0.93 |
| X-CT-Class | Clean |
| X-CT-Score | 0.00 |
| X-CT-RefID | str=0001.0A020202.5306E3D7.0109,ss=1,re=0.000,fgs=0 |
| X-CT-Spam | 0 |
| X-Authority-Analysis | v=2.0 cv=E9kTU9hl c=1 sm=1 a=MB85R812cvcrhCHz/P2OVA==:17 a=G8Uczd0VNMoA:10 a=N659UExz7-8A:10 a=kviXuzpPAAAA:8 a=l_aXpHVjmqQA:10 a=Fw2Eg70y9MAK1H-v8kMA:9 a=pILNOxqGKmIA:10 a=4vB-4DCPJfMA:10 a=MB85R812cvcrhCHz/P2OVA==:117 |
| X-CM-Score | 0.00 |
| Authentication-Results | cox.net; auth=pass (PLAIN) smtp.auth=swdunning@cox.net |
| Content-Type | text/plain; charset=windows-1252 |
| Mime-Version | 1.0 (Mac OS X Mail 7.1 \(1827\)) |
| Subject | Re: Function and turtle help |
| From | Scott W Dunning <swdunning@cox.net> |
| In-Reply-To | <75339005-9609-48D8-9DEF-EF0B0CEE7B39@cox.net> |
| Date | Thu, 20 Feb 2014 22:27:47 -0700 |
| Content-Transfer-Encoding | quoted-printable |
| References | <75339005-9609-48D8-9DEF-EF0B0CEE7B39@cox.net> |
| To | python-list@python.org |
| X-Mailer | Apple Mail (2.1827) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7206.1392960474.18130.python-list@python.org> (permalink) |
| Lines | 76 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1392960474 news.xs4all.nl 2869 [2001:888:2000:d::a6]:41221 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:66786 |
Show key headers only | View raw
On Feb 20, 2014, at 9:41 PM, Scott W Dunning <swdunning@cox.net> wrote:
> Hello,
>
> I am trying to make a function that allows me to color in a star that was drawn in Turtle. I just keep having trouble no matter what I do. I’ll post the code I have for the star (just in case). The ultimate goal is to create a script that’ll draw the American flag (we’re learning this piece by piece in class. So, I need to create a function that will color in the star that I can call multiple times for each star. Any help is greatly appreciated!
>
> Scott
>
> from turtle import *
> from math import sin, sqrt, radians
>
> showturtle()
> def star(width):
> R = (width)/2*sin(radians(72))
> A = (2*width)/(3+sqrt(5))
> penup()
> left(18)
> penup()
> forward(R)
> pendown()
>
> left(162)
> forward(A)
> right(72)
> forward(A)
>
> left(144)
> forward(A)
> right(72)
> forward(A)
>
> left(144)
> forward(A)
> right(72)
> forward(A)
>
> left(144)
> forward(A)
> right(72)
> forward(A)
>
> left(144)
> forward(A)
> right(72)
> forward(A)
>
> penup()
> left(180-18)
> penup()
> forward(R)
> penup()
> left(180-18)
> pendown()
> showturtle()
> star(500)
I think I’m having trouble with how functions operate. Here is what I have so far for the function to fill in the star with the color red. It’s obviously not working and not sure where I’m going wrong.
def fill_color(color):
color(red)
begin_fill()
penup()
end_fill()
fill_color(red)
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Function and turtle help Scott W Dunning <swdunning@cox.net> - 2014-02-20 22:27 -0700
csiph-web