Skip to content

Instantly share code, notes, and snippets.

@Raze369
Created June 27, 2015 21:02
Show Gist options
  • Select an option

  • Save Raze369/e1a54d0f00c932624a81 to your computer and use it in GitHub Desktop.

Select an option

Save Raze369/e1a54d0f00c932624a81 to your computer and use it in GitHub Desktop.
Forest HW.py
import canvas
canvas.set_size(1000, 600)
def draw_tree(x, y, w, trunk_h, leaf_h, trunk_w):
canvas.begin_path()
canvas.move_to(x-w/2, y+trunk_h)
canvas.add_line(x+w/2, y+trunk_h)
canvas.add_line(x, y + trunk_h+leaf_h)
canvas.close_path()
canvas.set_fill_color(0.25, 0.50, 0.00)
canvas.fill_path()
canvas.set_line_width(trunk_w)
canvas.set_stroke_color(0.50, 0.25, 0.00)
canvas.draw_line(x, y, x, y+trunk_h)
draw_tree(900, 00, 200, 50, 200, 50)
draw_tree(75, 00, 150, 40, 150, 50)
draw_tree(200, 110, 175, 40, 175, 55)
draw_tree(775, 125, 150, 40, 160, 45)
draw_tree(90, 220, 100, 30, 125, 40)
draw_tree(865, 260, 100, 30, 125, 40)
draw_tree(175, 350, 150, 40, 150, 50)
draw_tree(750, 350, 150, 40, 150, 50)
draw_tree(650, 450, 100, 30, 100, 40)
draw_tree(550, 425, 100, 30, 100, 40)
draw_tree(400, 460, 100, 30, 100, 40)
draw_tree(300, 450, 100, 30, 100, 40)
canvas.draw_image('Mushroom', 500, 300)
canvas.draw_image('Mushroom', 300, 100)
canvas.draw_image('Mushroom', 500, 25)
canvas.draw_image('Mushroom', 350, 250)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment