generated from mwc/project_drawing
67 lines
1.1 KiB
Python
67 lines
1.1 KiB
Python
# drawing.py
|
|
# ----------
|
|
# By Stacy S
|
|
#
|
|
# (Trying to draw a tree.)
|
|
|
|
from turtle import *
|
|
from math import sqrt
|
|
from shapes import draw_leaf
|
|
|
|
def draw_trunk(height):
|
|
right(270)
|
|
forward(2*height)
|
|
circle(-height/16,90)
|
|
|
|
def draw_branch(length):
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
circle(-length/16,135)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
circle(-length/16,135)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
circle(-length/16,135)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
circle(-length/16,135)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
circle(-length/16,90)
|
|
|
|
forward(2*length)
|
|
|
|
# roots
|
|
# [1,3,3,1]
|
|
circle(-length/16,45)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
|
|
circle(-length/16,135)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
|
|
circle(-length/16,135)
|
|
|
|
forward(length)
|
|
circle(length/8,180)
|
|
forward(length)
|
|
|
|
circle(-length/16,45)
|
|
|
|
input() |