generated from mwc/project_drawing
I made the wings and body line up correctly to make a butterfly. This took a lot of trial and error. Getting the starting coordinates and angels for each wing was very time consusming, but with each edit, it got better and better! I also sped up the turtle because it was so slow when I was continoussly trying to see the new drawing. I was able to use 'command ?' to help me do one wing at a time! Somewhere i got stuck was just understadning the coordinates or angles. To help with that, I looked up the corrodinate grid to help me better select the starting point.
57 lines
964 B
Python
57 lines
964 B
Python
# drawing.py
|
|
# ----------
|
|
# By Mishaal
|
|
#
|
|
# The program draws a butterfly
|
|
|
|
from turtle import *
|
|
|
|
from turtle import forward, right
|
|
from superturtle.movement import fly, no_delay
|
|
|
|
import turtle
|
|
|
|
screen = turtle.Screen()
|
|
screen.bgcolor("lightblue")
|
|
turtle.speed(10)
|
|
|
|
def draw_oval(width, height, color):
|
|
fillcolor(color)
|
|
begin_fill()
|
|
for i in range(2):
|
|
circle(width, 90)
|
|
circle(height, 90)
|
|
end_fill()
|
|
|
|
def draw_wing(x, y, width, height, color, angle):
|
|
penup()
|
|
goto(x, y)
|
|
setheading(angle)
|
|
pendown()
|
|
draw_oval(width, height, color)
|
|
|
|
|
|
def draw_body():
|
|
penup()
|
|
goto(0,25)
|
|
setheading(135)
|
|
pendown()
|
|
draw_oval(10,100,"black")
|
|
|
|
def draw_butterfly():
|
|
|
|
|
|
draw_wing(-10,-40, 50, 120, "indianred",50)
|
|
draw_wing(-10,-75, 40, 90, "palevioletred", 60)
|
|
|
|
draw_wing(10,25, 50, 120, "indianred",220)
|
|
draw_wing(10,-30, 40, 90, "palevioletred", 210)
|
|
|
|
draw_body()
|
|
|
|
draw_butterfly()
|
|
|
|
|
|
|
|
|
|
input() |