How to use turtle to draw moon cakes by python
This article mainly introduces python how to use turtle to draw moon cakes, the article is very detailed, has a certain reference value, interested friends must read it!
1. Use the function to explain the starting position of the brush and the position of the next pen.
2. Define the specific coordinate axis. Define color, number of radians, number of radians, and graphic size.
3. Define the words written on the moon cake.
4. Start drawing moon cakes with the functions defined above.
Example
Import turtleturtle.pensize (2) def goto (x, y): turtle.penup () turtle.goto (x, y) turtle.pendown () def rad (): goto (0,0) turtle.color ("# DAA520") # Color number to search for favorite colors for _ in range (30): turtle.left (12) turtle.begin_fill () turtle.forward (25) Turtle.goto (0,0) turtle.left (180) turtle.end_fill () def wirte (): goto (- 40,-40) turtle.color ("black") turtle.write ("wish:\ n\ nHappy Mid-Autumn Festival \ nHappy luck!, font= ("Time", 15, "bold") turtle.done () if _ _ name__ = ='_ main__': turtle.speed (60) rad () wirte () turtle.done () above is all the content of the article "how to use turtle to draw moon cakes by python". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!