I am participating in the Mid-Autumn Festival Creative Submission Contest. Please see: Mid-Autumn Festival Creative Submission Contest for details.

preface

The Mid-Autumn Festival is about to begin, the wandering partners also have no time to go back home to accompany their families, but go out, the moon cakes or to eat ah, to the nuggets of each partner to a taste of the style of moon cakes, white and white has helped you end on the table, you greatly please taste !!!!

Results show



Tool use

Development tool: pycharm development environment: python3.7, Windows10 using the tool kit: turtle

Analysis of learning ideas

Now I have in mind the basic shapes of mooncakes

First prepare to draw the moon cake lace, sunflower wave shape

The graph can be decomposed into an arc shape, and the center of the circle can be offset



Find the center of the circle and loop through all the shapes to create a perfect circle

Def huabian(): goto(0,0) turtle.color("orange") for _ in range(20): Turtle.right (18) turtle.begin_fill() turtle.forward(220) turtle.circle(40,180) turtle.goto(0,0) turtle.right(180) turtle.end_fill()Copy the code

It’s relatively easy to draw the circles that decorate each mooncake

Just identify the starting point and draw a circle

def yuan():
    turtle.color("#8fdb75")
    goto(0,-200)
    turtle.begin_fill()
    turtle.circle(200)
    turtle.end_fill()

Copy the code

The color scheme is a little bit strange, please forgive me, there is a sense of painting sunflower



Add the interior decoration to the moon cake, add the flower edge, looks more appetitive ha!!



Graphics are also a single image for circular stitching

Def huabian(): goto(0,0) turtle.color("orange") for _ in range(20): Turtle.right (18) turtle.begin_fill() turtle.forward(220) turtle.circle(40,180) turtle.goto(0,0) turtle.right(180) turtle.end_fill()Copy the code

Finally add the taste we like, egg yolk ah, like strawberry you can add strawberry, if you do not love sweet you can add braised pork, braised ribs, sweet and sour carp taste, white and white is more like durian taste to add it

Easy source sharing

import turtle def goto(x,y): turtle.penup() turtle.goto(x,y) turtle.pendown() def yuan(): turtle.color("#8fdb75") goto(0,-200) turtle.begin_fill() turtle.circle(200) turtle.end_fill() def huabian(): Goto (0,0) turtle.color("orange") for _ in range(20): Turtle.right (18) turtle.begin_fill() turtle.forward(220) turtle.circle(40,180) turtle.goto(0,0) turtle.right(180) turtle.end_fill() def neitu(): turtle.color("#D1C185") goto(0,-25) for _ in range(12): Turtle.begin_fill () turtle.circle(150,60) turtle.left(90) turtle.circle(150,60) turtle.end_fill() def wirte(): Goto (20) and 40 - turtle. The color (" orange ") turtle. Write (travel.like '\ n \ n \ n durian', the font = (' Time ', 30, 'bold')) turtle. Done if __name__ = = () '__main__': turtle.speed(20) huabian() yuan() neitu() wirte() turtle.done()Copy the code

I am white and white I, a program yuan like to share knowledge ❤️

If you don’t know how to program or want to learn how to program, you can leave a message on this blog. Thank you very much for your likes, favorites, comments, one-click support.