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


Groups > comp.lang.python > #65851

Re:Drawing polygons in python turtle

From Dave Angel <davea@davea.name>
Subject Re:Drawing polygons in python turtle
Date 2014-02-10 19:00 -0500
Organization news.gmane.org
References <4fa08222-582c-4585-b945-e67468c66f6d@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.6642.1392076659.18130.python-list@python.org> (permalink)

Show all headers | View raw


 geniusrko@gmail.com Wrote in message:
> Hi
> can anyone help finding the angle to draw different polygons shapes
> 
> in this example 
> 
> import turtle 
> wm = turtle.Screen()
> alex = turtle.Turtle()
> for i in range(5):
>     alex.left(216)
>     alex.forward(50)
> wm.exitonclick() 
> 
> Why do we use 216
> 

216 degrees doesn't seem to me that it would make a polygon, but
 rather a star.

I can tell you what I remember about geometry, however. To make a
 regular polygon,  you need to turn by a fixed amount and go a
 fixed distance each time. 

For an equilateral triangle,  you turn 120 degrees. For a square, 
 90. For a pentagon,  108.

180 - (360/n) degrees.


-- 
DaveA

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


Thread

Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 15:44 -0800
  Re:Drawing polygons in python turtle Dave Angel <davea@davea.name> - 2014-02-10 19:00 -0500
  Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 16:23 -0800
    Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 16:34 -0800
      Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 18:13 -0800
        Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 18:49 -0800
          Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 18:51 -0800
            Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 18:59 -0800
              Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 19:01 -0800
                Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 19:03 -0800
                Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 19:06 -0800
                Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 19:17 -0800
                Re: Drawing polygons in python turtle geniusrko@gmail.com - 2014-02-10 19:19 -0800
                Re: Drawing polygons in python turtle Asaf Las <roegltd@gmail.com> - 2014-02-10 19:23 -0800
                Re: Drawing polygons in python turtle Terry Reedy <tjreedy@udel.edu> - 2014-02-11 04:35 -0500
        Re: Drawing polygons in python turtle Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-11 08:17 -0500

csiph-web