[Merry Christmas] Ding Dong, it doesn't matter if no one gives you a Christmas present. You can come to me? As long as you speak, I won't~



Christmas for westerners means family reunion to welcome the new year.
In China, Christmas is one of the most loved festivals for Chinese couples.

what? Become a single dog and become a leftover egg?! It doesn't matter. Today Muzi only used one move to get you off the order quickly!

As the saying goes: all love without gifts is playing hooligans! But what gift to give is a great test of a person's IQ, EQ

FGHJKLMNOPQ, especially in the face of girls, what gifts are you going to give for Christmas?

Send flowers 🌹? Send apples 🍎? Send chocolate 🥮? Eat Christmas dinner 🍱?

Stereotyped, how can people see your sincerity! Let's see how programmers spend Christmas!    

Christmas - Love - Romance - Beauty - is to spoil you

Mumuzi turns into Santa Claus and begins to distribute Christmas gift bags: please accept the love given to you!👇



This paper is mainly a drawing applet based on Turtle. (including multiple source code drops) it's super nice~

I 🎄 Lovely Christmas Eve circle of friends copy

❶🦌•┈ ✨ ┈ 🌟┈🎄┈🌟┈✨┈•🦌

Hang the elk on the Christmas tree and you in my heart ✨


❸ 🍎 It may be my greatest wish to receive an apple from you

❹ turn over your socks and hang them inside out. The whole world is my gift. Hey, hey, I can be a little clever 🥳

❺ 💍 Merry Christmas is not as good as Mary me *

❻ you turn on the front camera, see? It's my most wanted Christmas present ✨

2, Christmas tree on a snowy night

snowflake ❄ All the time, of course, there is background music~

1) Effect display

2) Code demonstration

<span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#f8f8f8"># Initialize pygame
#Set the screen width and height, and adjust according to the background image
bg_img = "bg.png"
bg_size = (609, 601)
screen = pygame.display.set_mode(bg_size)
pygame.display.set_caption("Christmas tree on a snowy night")
bg = pygame.image.load(bg_img)
# Snowflake list
snow_list = []
for i in range(150):
    x_site = random.randrange(0, bg_size[0])   # Snowflake center position
    y_site = random.randrange(0, bg_size[1])   # Snowflake center position
    X_shift = random.randint(-1, 1)         # x-axis offset
    radius = random.randint(4, 6)           # Radius and y-cycle descent
    snow_list.append([x_site, y_site, X_shift, radius])
# Create clock object
clock = pygame.time.Clock()
# Add music
track = pygame.mixer.music.load('my.mp3')  # Load music file
pygame.mixer.music.play() # Play music stream
pygame.mixer.music.fadeout(600000)  # Set music end time
done = False
while not done:
    # Message event loop, judge exit
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
    screen.blit(bg, (0, 0))
    # Snowflake list loop
    for i in range(len(snow_list)):
        # Draw snowflakes, color, position and size
        pygame.draw.circle(screen, (255, 255, 255), snow_list[i][:2], snow_list[i][3] - 3)
        # Move snowflake position (next cycle takes effect)
        snow_list[i][0] += snow_list[i][2]
        snow_list[i][1] += snow_list[i][3]
        # If snowflakes fall off the screen, reset the position
        if snow_list[i][1] > bg_size[1]:
            snow_list[i][1] = random.randrange(-50, -10)
            snow_list[i][0] = random.randrange(0, bg_size[0])
    # Refresh screen

3, The 🎄 Lovely Christmas Eve circle of friends copy

❼🔔 ྀི♡ >> ♥️♥️♥️

If you are put in a sack on Christmas day, please don't be afraid, because the Christmas gift I want is you.

❽ 🔔 I'm ling'er

🌲 You are jingle because Ling Er wants to jingle • • •

❾ I'm cute. How about making your Christmas present

❶⓪ if I ask Santa for you, will he give it ★

IV. ℳ ᴇ ʀʀ Ꮍ 🎅 ྀིℂ ʜʀɪ sᴛᴍᴀs

1) Effect display

2) Code demonstration

<span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#f8f8f8">import turtle as t
from turtle import *
import random as r
import time
n = 100.0
color("orange", "yellow")
for i in range(5):
def drawlight():
    if r.randint(0, 30) == 0:
    elif r.randint(0,30) == 1:
        color('dark green')
color("dark green")
def tree(d, s):
    if d <= 0: return
    tree(d-1, s*.8)
    tree(d-3, s*.5)
    drawlight()#Draw small colored lights at the same time
    tree(d-3, s*.5)
tree(15, n)
for i in range(200):
    a = 200 - 400 * r.random()
    b = 10 - 20 * r.random()
    if r.randint(0, 1) == 0:
t.color("dark red","red")
t.write("Merry Christmas",align ="center",font=("Comic Sans MS",40,"bold"))#write
def drawsnow():
    t.ht()  #Hide pen head, ht=hideturtle
    t.pensize(2)  #Define pen size
    for i in range(200): #How many snowflakes do you draw
        t.pencolor("white") #Defining the brush color as white actually means that snowflakes are white
        t.pu() #Pen lifting, pu=penup
        t.setx(r.randint(-350,350)) #Define the x coordinate and randomly select from - 350 to 350
        t.sety(r.randint(-100,350)) #Define the y coordinate. Note that snowflakes generally do not fall on the ground, so they do not start from the too small longitudinal seat axis
        t.pd() #Write, pd=pendown
        dens = 6 #The number of snowflakes is set to 6
        snowsize = r.randint(1,10) #Define snowflake size
        for j in range(dens): #That's 6, that's 5 times, that's a snowflake five pointed star
            #t.forward(int(snowsize))  #int() takes an integer
            #t.bd(int(snowsize))  #Note that there is no bd=backward, but there is fd=forward, a small bug
            t.right(int(360/dens))  #Rotation angle

5, The 🎄 Lovely Christmas Eve circle of friends copy

❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶❶101 🧐

❶ there is no Santa Claus in the world. All gifts and surprises come from people who love you

❶ ❸ although there is no Santa Claus in the world who will sneak gifts into your socks when you sleep, there will always love you

People prepare small surprises for you on special days ✨

❶❹ 🔔 🍎 🎊 ℳᴇʀʀᎽ🎅 ྀིℂʜʀɪsᴛᴍᴀs🎄🍬

❶❺🍎 🛎🎈❄️ ♥️ 🍏

I hope the Christmas tree / gift / snowflake will come with you ✨ Christmas in 2021 🎄

6, Christmas gifts 🎅

Source code too much, private letter me ha!


Finally, I wish you an early Christmas! Source code didi I can!

💦 Free source code collection: Didi, I can~

Or take it from my home page (pc side)!

Your support is my biggest motivation!! Remember the third consecutive oh ~mua# welcome to read the previous articles~

💨 Previous game reading recommendations——

Item 10.2: Brick playing games

Program O takes you to recall the classic: developing a brick playing game with native Python~

Item 10.1 squid game: 123 wooden man

When "squid game" came: "one, two, three, wooden man, Smecta." Are you still scared?

Project 1.0 # super Mary

Programmer homemade game: Super Mary 100% real version, which can make you cry ~ [with source code]

Item 1.1 mine clearance

Pygame actual combat: it is said that this is the most difficult minesweeping game in history. There is no one. Feel it

🍓 Article summary——

Item 1.0 Python-2021 | summary of existing articles | continuously updated. It's enough to read this article directly

(more content + source code are summarized in the article!! welcome to read ~)


            - MERRY CHRISTMAS -


Merry Christmas
​​ ​




Keywords: Python turtle

Added by alluoshi on Fri, 17 Dec 2021 19:23:51 +0200