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


Groups > comp.lang.python > #66787

Function and turtle help

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!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.045
X-Spam-Evidence '*H*': 0.91; '*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; 'do.': 0.18; 'trying': 0.19; 'received:10.0.1': 0.19; 'import': 0.22; 'math': 0.24; 'script': 0.25; 'class.': 0.26; 'post': 0.26; '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; 'to:addr:python.org': 0.39; 'color': 0.61; 'matter': 0.61; 'times': 0.62; 'header :Message-Id:1': 0.63; 'charset:windows-1252': 0.65; 'american': 0.66; 'goal': 0.75; 'scott': 0.93; 'ultimate': 0.93
X-CT-Class Clean
X-CT-Score 0.00
X-CT-RefID str=0001.0A020207.5306D8F0.00F6,ss=1,re=0.000,fgs=0
X-CT-Spam 0
X-Authority-Analysis v=2.0 cv=Ve8pyiV9 c=1 sm=1 a=MB85R812cvcrhCHz/P2OVA==:17 a=G8Uczd0VNMoA:10 a=N659UExz7-8A:10 a=kviXuzpPAAAA:8 a=G7Fzl4b_VnMA:10 a=ybq7GjEBbjkNOtw_jxkA:9 a=pILNOxqGKmIA:10 a=MB85R812cvcrhCHz/P2OVA==:117
X-CM-Score 0.00
Authentication-Results cox.net; auth=pass (PLAIN) smtp.auth=swdunning@cox.net
From Scott W Dunning <swdunning@cox.net>
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
Subject Function and turtle help
Date Thu, 20 Feb 2014 21:41:06 -0700
To python-list@python.org
Mime-Version 1.0 (Mac OS X Mail 7.1 \(1827\))
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.7207.1392961605.18130.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392961605 news.xs4all.nl 2841 [2001:888:2000:d::a6]:45756
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66787

Show key headers only | View raw


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)

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


Thread

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

csiph-web