generated from mwc/project_drawing
Created a static image of a penguin on an iceberg
I was struggling how to draw an oval for my penguin. I needed to look up videos/read up how to do it. I also had to look up how to set the size of the image. I found it really difficult to just start the penguin, but once I got the shapes I felt more comfortable.
This commit is contained in:
88
trial.py
Normal file
88
trial.py
Normal file
@@ -0,0 +1,88 @@
|
||||
import turtle
|
||||
|
||||
# --- Setup ---
|
||||
turtle.setup(800, 500)
|
||||
screen = turtle.Screen()
|
||||
screen.title("Penguin on Ice")
|
||||
screen.bgcolor("white")
|
||||
|
||||
pen = turtle.Turtle()
|
||||
pen.speed(8)
|
||||
pen.pensize(2)
|
||||
|
||||
# --- Draw ocean ---
|
||||
pen.penup()
|
||||
pen.goto(-400, -100)
|
||||
pen.pendown()
|
||||
pen.fillcolor("royalblue")
|
||||
pen.begin_fill()
|
||||
for _ in range(2):
|
||||
pen.forward(800)
|
||||
pen.right(90)
|
||||
pen.forward(250)
|
||||
pen.right(90)
|
||||
pen.end_fill()
|
||||
|
||||
# --- Draw ice block ---
|
||||
pen.penup()
|
||||
pen.goto(-400, -100)
|
||||
pen.pendown()
|
||||
pen.pencolor("black")
|
||||
pen.fillcolor("white")
|
||||
pen.begin_fill()
|
||||
pen.forward(350) # top edge
|
||||
pen.right(90)
|
||||
pen.forward(100) # side edge
|
||||
pen.right(90)
|
||||
pen.forward(350)
|
||||
pen.end_fill()
|
||||
|
||||
# --- Draw penguin body ---
|
||||
pen.penup()
|
||||
pen.goto(0, -100)
|
||||
pen.left(90)
|
||||
pen.pendown()
|
||||
pen.circle(40, 180) # big oval side
|
||||
pen.circle(40, 180)
|
||||
|
||||
# --- Draw penguin belly (smaller oval) ---
|
||||
pen.penup()
|
||||
pen.goto(10, -100)
|
||||
pen.setheading(90)
|
||||
pen.pendown()
|
||||
pen.circle(20, 360)
|
||||
|
||||
# --- Draw head ---
|
||||
pen.penup()
|
||||
pen.goto(0, -20)
|
||||
pen.setheading(0)
|
||||
pen.pendown()
|
||||
pen.circle(20)
|
||||
|
||||
# --- Draw beak (triangle) ---
|
||||
pen.penup()
|
||||
pen.goto(20, -10)
|
||||
pen.pendown()
|
||||
pen.setheading(0)
|
||||
pen.forward(20)
|
||||
pen.right(120)
|
||||
pen.forward(20)
|
||||
pen.right(120)
|
||||
pen.forward(20)
|
||||
|
||||
# --- Draw feet ---
|
||||
pen.penup()
|
||||
pen.goto(-5, -100)
|
||||
pen.pendown()
|
||||
pen.setheading(-30)
|
||||
pen.forward(20)
|
||||
|
||||
pen.penup()
|
||||
pen.goto(5, -100)
|
||||
pen.pendown()
|
||||
pen.setheading(-150)
|
||||
pen.forward(20)
|
||||
|
||||
# Done
|
||||
pen.hideturtle()
|
||||
turtle.done()
|
||||
Reference in New Issue
Block a user