Untitled
Anonymous
plain_text
02/01/2025 4:09 PM
2.2 KB
21
Indexable
import turtle
# Setup layar
screen = turtle.Screen()
screen.bgcolor("white")
# Setup turtle
pen = turtle.Turtle()
pen.speed(10)
pen.width(3)
# Fungsi untuk menggambar kepala Barongsai
def draw_head():
pen.color("red")
pen.begin_fill()
pen.circle(50)
pen.end_fill()
pen.penup()
pen.goto(-30, 60)
pen.pendown()
pen.color("white")
pen.begin_fill()
pen.circle(10)
pen.end_fill()
pen.penup()
pen.goto(30, 60)
pen.pendown()
pen.begin_fill()
pen.circle(10)
pen.end_fill()
# Fungsi untuk menggambar mata
def draw_eyes():
pen.penup()
pen.goto(-20, 80)
pen.pendown()
pen.color("black")
pen.begin_fill()
pen.circle(5)
pen.end_fill()
pen.penup()
pen.goto(20, 80)
pen.pendown()
pen.begin_fill()
pen.circle(5)
pen.end_fill()
# Fungsi untuk menggambar mulut
def draw_mouth():
pen.penup()
pen.goto(-40, 40)
pen.pendown()
pen.color("black")
pen.right(90)
pen.circle(40, 180)
pen.left(90)
# Fungsi untuk menggambar badan
def draw_body():
pen.penup()
pen.goto(-60, -50)
pen.pendown()
pen.color("green")
pen.begin_fill()
for _ in range(2):
pen.forward(120)
pen.right(90)
pen.forward(200)
pen.right(90)
pen.end_fill()
# Fungsi untuk menggambar ekor
def draw_tail():
pen.penup()
pen.goto(60, -50)
pen.pendown()
pen.color("yellow")
pen.begin_fill()
pen.right(45)
pen.forward(100)
pen.left(90)
pen.forward(100)
pen.left(135)
pen.forward(140)
pen.end_fill()
# Menggambar Barongsai
draw_head()
draw_eyes()
draw_mouth()
draw_body()
draw_tail()
# Selesai
pen.hideturtle()
turtle.done()Editor is loading...
Leave a Comment