-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draw smiling face emoji using Turtle in Python
Draw smiling face emoji using Turtle in Python
- Loading branch information
1 parent
de6cf6b
commit c0c269d
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
# Python program to draw smile | ||
# face emoji using turtle | ||
import turtle | ||
|
||
# turtle object | ||
pen = turtle.Turtle() | ||
|
||
# function for creation of eye | ||
def eye(col, rad): | ||
pen.down() | ||
pen.fillcolor(col) | ||
pen.begin_fill() | ||
pen.circle(rad) | ||
pen.end_fill() | ||
pen.up() | ||
|
||
|
||
# draw face | ||
pen.fillcolor('yellow') | ||
pen.begin_fill() | ||
pen.circle(100) | ||
pen.end_fill() | ||
pen.up() | ||
|
||
# draw eyes | ||
pen.goto(-40, 120) | ||
eye('white', 15) | ||
pen.goto(-37, 125) | ||
eye('black', 5) | ||
pen.goto(40, 120) | ||
eye('white', 15) | ||
pen.goto(40, 125) | ||
eye('black', 5) | ||
|
||
# draw nose | ||
pen.goto(0, 75) | ||
eye('black', 8) | ||
|
||
# draw mouth | ||
pen.goto(-40, 85) | ||
pen.down() | ||
pen.right(90) | ||
pen.circle(40, 180) | ||
pen.up() | ||
|
||
# draw tongue | ||
pen.goto(-10, 45) | ||
pen.down() | ||
pen.right(180) | ||
pen.fillcolor('red') | ||
pen.begin_fill() | ||
pen.circle(10, 180) | ||
pen.end_fill() | ||
pen.hideturtle() | ||
|
||
pen.screen.mainloop() |