Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66789
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re:Function and turtle help |
| Date | 2014-02-21 01:30 -0500 |
| Organization | news.gmane.org |
| References | <75339005-9609-48D8-9DEF-EF0B0CEE7B39@cox.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7209.1392963991.18130.python-list@python.org> (permalink) |
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
Re:Function and turtle help Dave Angel <davea@davea.name> - 2014-02-21 01:30 -0500
csiph-web