generated from mwc/project_drawing
I decided to get slightly more detailed. I adjusted the colors to make it cuter. I then added attenae to add the final touch. I was even able to add a little dot at the end to make it cuter. I then attdjsuted the size of the pen to make the drawing more solid. I had to look up how to hide the pen because I think it is distracting to look at. I also looked up how to mkae the turtle draw the drawing at the fastest speed. Both of those things helped me greatly! I am now done with the project. I definitely couldve done more but due to time, and starting late, I am still happy with how much I got done. I was ableto learn a lot doing this project!
83 lines
1.3 KiB
Python
83 lines
1.3 KiB
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(0)
|
|
|
|
|
|
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()
|
|
|
|
def draw_a():
|
|
penup()
|
|
goto(-7,25)
|
|
pendown()
|
|
pensize(3)
|
|
color("black")
|
|
|
|
setheading(100)
|
|
circle(65,80)
|
|
pensize(8)
|
|
forward(1)
|
|
penup()
|
|
|
|
goto(-7,25)
|
|
pendown()
|
|
pensize(3)
|
|
|
|
setheading(80)
|
|
circle(-65,80)
|
|
pensize(8)
|
|
forward(1)
|
|
penup()
|
|
|
|
|
|
pensize(5)
|
|
hideturtle()
|
|
draw_butterfly()
|
|
draw_a()
|
|
|
|
|
|
input() |