Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://youtu.be/1kvBKFkqMHM
- import turtle
- import math
- soixante =math.pi/3 #60 degrees ou pi/3 rads.
- angle=0
- radio =200
- #Calculer une position un point de l'hexagone
- def position(angle):
- return ( (round (math.cos( angle)*radio )), round ((math.sin (angle))*radio))
- turtle.shape('turtle')
- turtle.color('blue')
- #premier point ...
- turtle.up()
- turtle.goto(radio,0)
- turtle.down()
- #turtle.begin_fill()
- while (angle<= (soixante*6) ):#6 fois 60 deg
- #print (position(angle))
- turtle.goto(position (angle))
- #turtle.write(arg, move=False, align="left", font=("Arial", 8, "normal"))
- turtle.write( str(round (math.degrees (angle)))+"°" +str (position(angle)),font=("Arial", 16, "normal"))# écrire l'angle
- turtle.delay(100) #retard
- angle+=soixante
- #turtle.end_fill()
- turtle.done()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement