Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw a funny expression with Python

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to draw a funny expression with Python". The content is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "how to draw a funny expression with Python".

Everyone should know that Python's turtle library can draw pictures, so we use this library to draw a smirk.

As the expression on Wechat is small and looks inconvenient, I found a larger one on the Internet, as follows:

We can see that the components of this expression include: face frame (that is, the big circle), eyebrows, eye sockets, eyes, red cheeks, mouth, below we begin to draw these parts.

First, we draw a face frame, and the code implementation is as follows:

Penup ()

Goto (- 210J 0)

Seth (- 90)

Pendown ()

Pencolor ('# FFCC33')

Pensize (4)

Begin_fill ()

Circle (210360)

Fillcolor ('# FFFF99')

End_fill ()

Pencolor ('# 330033')

Take a look at the effect:

Then the eyebrow, the code implementation is as follows:

# left eyebrow

Penup ()

Pensize (4)

Goto (- 180140)

Pencolor ('# 585858')

Pendown ()

Seth (70)

Circle (- 60140)

# right eyebrow

Penup ()

Pensize (4)

Goto (180140)

Pencolor ('# 585858')

Pendown ()

Seth (110C)

Circle (60140)

Take a look at the effect:

Then draw the eye sockets and eyeballs, and the code is as follows:

# left orbit

Penup ()

Pensize (4)

Goto (- 180,090)

Pencolor ('# 909090')

Pendown ()

Seth (40)

Begin_fill ()

Circle (- 120,5080)

Penup ()

Goto (- 180,090)

Seth (- 130C)

Pendown ()

Circle (15110)

Seth (40)

Circle (- 1063.83)

Seth (30)

Circle (18105)

Fillcolor ('white')

End_fill ()

# right orbital

Penup ()

Goto (20pl 90)

Pendown ()

Seth (40)

Begin_fill ()

Circle (- 120,5080)

Penup ()

Goto (20pl 90)

Pendown ()

Seth (- 130C)

Circle (15110)

Seth (40)

Circle (- 1063.83)

Seth (30)

Circle (18105)

Fillcolor ('white')

End_fill ()

# eyeballs

Pensize (2)

Penup ()

Goto (30pr 83)

Pendown ()

Begin_fill ()

Circle (8360)

Fillcolor ('black')

End_fill ()

Penup ()

Goto (- 1708,83)

Pendown ()

Begin_fill ()

Circle (8360)

Fillcolor ('black')

End_fill ()

Take a look at the effect:

Then draw red cheeks, and the code is implemented as follows:

Pensize (1)

Pencolor ('LightSalmon')

Begin_fill ()

Penup ()

Goto (- 160550)

Pendown ()

Seth (- 90)

For i in range (2):

For j in range (10):

Forward (j)

Left (9)

For j in range (1010, 010, 10):

Forward (j)

Left (9)

Fillcolor ('LightSalmon')

End_fill ()

Pensize (1)

Pencolor ('LightSalmon')

Begin_fill ()

Penup ()

Goto (40 and 50)

Pendown ()

Seth (- 90)

For i in range (2):

For j in range (10):

Forward (j)

Left (9)

For j in range (1010, 010, 10):

Forward (j)

Left (9)

Fillcolor ('LightSalmon')

End_fill ()

Hideturtle ()

Take a look at the effect:

Finally, we draw the mouth, and the code is implemented as follows:

Pensize (5)

Penup ()

Goto (- 1501m / m / 30)

Pencolor ('# 585858')

Pendown ()

Seth (- 90)

Circle (150180)

Take a look at the end result:

The above is all the contents of the article "how to draw a funny expression with Python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report