draw goku in python

To draw Goku using Python, we can make use of the Python's inbuilt graphics module called Turtle. Here is the code to draw Goku using Turtle:

main.py
import turtle

# Set up the screen
screen = turtle.Screen()
screen.setup(700, 700)
screen.title("Goku")

# Create the turtle object
goku = turtle.Turtle()
goku.speed(0)
goku.penup()
goku.goto(-70, 120)
goku.pendown()

# Draw the hair
goku.color("black", "black")
goku.begin_fill()
for i in range(180):
    goku.forward(1.2)
    goku.right(1)
goku.end_fill()

# Draw the face
goku.penup()
goku.goto(20, 40)
goku.pendown()
goku.color("light gray", "light gray")
goku.begin_fill()
goku.circle(60)
goku.end_fill()

# Draw the eyes
goku.penup()
goku.goto(-10, 80)
goku.pendown()
goku.color("white", "white")
goku.begin_fill()
goku.circle(10)
goku.end_fill()

goku.penup()
goku.goto(-10, 90)
goku.pendown()
goku.color("black", "black")
goku.begin_fill()
goku.circle(5)
goku.end_fill()

goku.penup()
goku.goto(30, 80)
goku.pendown()
goku.color("white", "white")
goku.begin_fill()
goku.circle(10)
goku.end_fill()

goku.penup()
goku.goto(30, 90)
goku.pendown()
goku.color("black", "black")
goku.begin_fill()
goku.circle(5)
goku.end_fill()

#Draw the mouth
goku.penup()
goku.goto(0, 45)
goku.pendown()
goku.right(90)
goku.circle(20, 180)

#Draw the uniform
goku.penup()
goku.goto(-100, -60)
goku.pendown()
goku.color("orange", "orange")
goku.begin_fill()
for i in range(2):
    goku.forward(200)
    goku.left(90)
    goku.forward(120)
    goku.left(90)
goku.end_fill()

#Draw the belt
goku.penup()
goku.goto(-50, -60)
goku.pendown()
goku.color("blue", "blue")
goku.begin_fill()
goku.forward(100)
goku.right(90)
goku.forward(20)
goku.right(90)
goku.forward(100)
goku.right(90)
goku.forward(20)
goku.end_fill()

#Draw the legs
goku.penup()
goku.goto(-50, -180)
goku.pendown()
goku.color("blue", "blue")
goku.begin_fill()
goku.right(90)
goku.forward(70)
goku.right(90)
goku.forward(50)
goku.right(90)
goku.forward(70)
goku.right(90)
goku.forward(50)
goku.end_fill()

goku.penup()
goku.goto(0, -180)
goku.pendown()
goku.color("blue", "blue")
goku.begin_fill()
goku.right(90)
goku.forward(70)
goku.right(90)
goku.forward(50)
goku.right(90)
goku.forward(70)
goku.right(90)
goku.forward(50)
goku.end_fill()

#Draw the shoes
goku.penup()
goku.goto(-65, -230)
goku.pendown()
goku.color("black", "black")
goku.begin_fill()
goku.right(90)
goku.forward(20)
goku.left(90)
goku.forward(30)
goku.left(90)
goku.forward(20)
goku.right(90)
goku.forward(10)
goku.right(90)
goku.forward(20)
goku.left(90)
goku.forward(10)
goku.end_fill()

goku.penup()
goku.goto(35, -230)
goku.pendown()
goku.color("black", "black")
goku.begin_fill()
goku.right(90)
goku.forward(20)
goku.left(90)
goku.forward(30)
goku.left(90)
goku.forward(20)
goku.right(90)
goku.forward(10)
goku.right(90)
goku.forward(20)
goku.left(90)
goku.forward(10)
goku.end_fill()

turtle.done()
2725 chars
171 lines

This code will draw a full body image of Goku in Turtle Graphics. The turtle library provides various methods to draw images, shapes and colours on the canvas. By using different turtle commands, you can achieve any desired output in a very simple way.

related categories

gistlibby LogSnag