User:-Python turtle graphics-/flower hexagon: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Hexagon-hexagons.jpg|thumbnail]]
==flower hexagon==
 
[[File:Flower hexagon.jpg]]
 
<source lang="python">
 
import turtle
import turtle


Line 18: Line 23:




def drawing(size):
def drawing(size):


for i in range(6):
for i in range(18):


print hexagon(60,size)
print hexagon(60,size)


turtle.left(60)
turtle.left(20)




Line 34: Line 39:
turtle.color(random.randint(0,1),random.randint(0,1),random.randint(0,1))
turtle.color(random.randint(0,1),random.randint(0,1),random.randint(0,1))


turtle.width(random.randint(0,3))
turtle.width(random.randint(1,2))






turtle.exitonclick()
turtle.exitonclick()

Latest revision as of 08:11, 7 October 2013

flower hexagon

Flower hexagon.jpg

<source lang="python">

import turtle

import random


def hexagon(angle,size):

angle=60

for i in range(6):

turtle.forward(size)

turtle.left(angle)


def drawing(size):

for i in range(18):

print hexagon(60,size)

turtle.left(20)


while(1):

print drawing(random.randint(40,100))

turtle.color(random.randint(0,1),random.randint(0,1),random.randint(0,1))

turtle.width(random.randint(1,2))


turtle.exitonclick()