0% found this document useful (0 votes)
45 views4 pages

Cartoon Character

The document contains a Python script using the turtle graphics library to draw a character resembling Bart Simpson. It includes commands for filling shapes, moving the turtle, and drawing various geometric forms. The script also encounters an error due to an undefined color variable 'white' which is later corrected.

Uploaded by

sethcabulay1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views4 pages

Cartoon Character

The document contains a Python script using the turtle graphics library to draw a character resembling Bart Simpson. It includes commands for filling shapes, moving the turtle, and drawing various geometric forms. The script also encounters an error due to an undefined color variable 'white' which is later corrected.

Uploaded by

sethcabulay1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CODE

import turtle
turtle.getscreen()
<turtle._Screen object at 0x0000013AADF63250>
tr = turtle.Turtle()
tr.fillcolor('yellow')
tr.penup()
tr.setpos(32,4)
tr.pendown()
tr.begin_fill()
tr.left(50)
tr.forward(100)
tr.undo()
tr.left(40)
tr.forward(100)
tr.left(45)
for i in range(7):
tr.forward(10)
tr.left(120)
tr.forward(10)
tr.right(120)

for i in range(28):
tr.undo()

tr.right(15)
for i in range(7):
tr.forward(10)
tr.left(120)
tr.forward(10)
tr.right(120)

tr.undo()
tr.undo()
tr.right(165)
tr.left(15)
tr.right(180)
tr.forward(100)
tr.left(90)
tr.forward(50)
tr.back(20)
tr.right(60)
tr.forward(20)
tr.left(60)
tr.forward(25)
tr.left(90)
tr.forward(10)
tr.end_fill()
tr.penup()
tr.right(90)
tr.fillcolor(white)
Traceback (most recent call last):
File "<pyshell#39>", line 1, in <module>
tr.fillcolor(white)
NameError: name 'white' is not defined
tr.fillcolor('white')
tr.setpos(-25,36)
tr.pendown()
tr.begin_fill()
tr.circle(15)
tr.end_fill()
tr.setpos(-15,32)
tr.undo()
tr.forward(10)
tr.forward(10)
tr.back(20)
tr.left(90)
tr.forward(10)
tr.right(90)
tr.forward(30)
tr.setpos(2,36)
tr.undo()
tr.penup()
tr.setpos(2,36)
tr.pendown()
tr.begin_fill()
tr.circle(15)
tr.end_fill()
tr.penup()
tr.fillcolor('black')
tr.left(90)
tr.forward(25)
tr.back(15)
tr.circle(5)
tr.right(90)
tr.pendown()
tr.begin_fill()
tr.circle(2)
tr.end_fill()
tr.penup()
tr.back(25)
tr.back(5)
tr.begin_fill()
tr.pendown()
tr.circle(2)
tr.end_fill()
tr.penup()
tr.right(90)
tr.forward(100)
tr.left(90)
tr.write('Bart Simpson', font =('Open Sans', 12, 'normal'))

You might also like