In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use python to draw moon cakes, the article is very detailed, has a certain reference value, interested friends must read it!
1. Environmental installation. Turtle comes with it, so you don't have to install it separately.
2. Create a moon cake .py file.
Import turtle
3. Define the pen function, which is a paintbrush.
T = turtle.Pen ()
4. Circle commands to draw the shape of moon cakes.
For i in range (30): # using the for loop, you can repeat the above drawing multiple times. Until it is drawn into a garden. T.begin_fill () t.forward (200) # We moved the brush t to the distance of 200 pixels in the direction of the arrow t.circle (30180) # We drew a small arc of t.goto (0) # We returned the brush t to its original position (0) t.right (0) t.right (12)
5. Color the moon cakes.
Import turtlet = turtle.Pen () t.speed (0) # to control the speed of drawing turtle.colormode (255) # tells Python that we use RGB to specify the color t.color ((0meme 0p0)) # means that the color consists of red 0 green 0 blue 0 chocolate color pure black. For i in range (30): t.begin_fill () t.forward (200) t.circle (30180) t.goto (0L0) t.right (180) t.right (12) t.end_fill () # the graphics between begin_fill () and end_fill () will fill all the contents of the article "how to draw mooncakes with python" above the color we specify. Thank you for reading! Hope to share the content to help you, more related 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.