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


Groups > comp.lang.python > #66789

Re:Function and turtle help

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'turtle': 0.07; 'subject:help': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Function': 0.09; 'def': 0.12; 'wrote': 0.14; '(just': 0.16; 'appreciated!': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'star.': 0.16; 'subject:turtle': 0.16; 'do.': 0.18; 'trying': 0.19; 'import': 0.22; 'math': 0.24; 'script': 0.25; 'class.': 0.26; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'skip:( 20': 0.30; 'code': 0.31; 'piece': 0.31; 'allows': 0.31; 'trouble': 0.34; 'so,': 0.37; 'star': 0.38; 'to:addr:python- list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'color': 0.61; 'matter': 0.61; 'times': 0.62; 'making': 0.63; 'american': 0.66; 'goal': 0.75; 'i\xe2\x80\x99ll': 0.84; 'shape.': 0.84; 'subject::': 0.85; 'scott': 0.93; 'ultimate': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dave Angel <davea@davea.name>
Subject Re:Function and turtle help
Date Fri, 21 Feb 2014 01:30:10 -0500 (EST)
Organization news.gmane.org
References <75339005-9609-48D8-9DEF-EF0B0CEE7B39@cox.net>
X-Gmane-NNTP-Posting-Host dpc6744192008.direcpc.com
X-Newsreader PiaoHong Usenet NewsReaders 1.36
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.7209.1392963991.18130.python-list@python.org> (permalink)
Lines 65
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392963991 news.xs4all.nl 2854 [2001:888:2000:d::a6]:60668
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66789

Show key headers only | View raw


 Scott W Dunning <swdunning@cox.net> Wrote in message:
> 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)
 
> 

Look at turtle.begin_fill and turtle.end_fill

That's after making sure your star is a closed shape.


-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re:Function and turtle help Dave Angel <davea@davea.name> - 2014-02-21 01:30 -0500

csiph-web