新年祝福python

部署运行你感兴趣的模型镜像

1.0版本

import turtle
import time
import random
import math

# 设置窗口
wn = turtle.Screen()
wn.title("新年快乐!")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)

# 定义颜色列表
colors = ["red", "orange", "yellow", "green", "blue", "purple", "pink"]

# 倒计时类
class Countdown(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.hideturtle()
        self.color("white")
        self.goto(0, 250)
        self.font = ("Arial", 80, "bold")

    def countdown_display(self, seconds):
        self.clear()
        self.write(f"{seconds}", align="center", font=self.font)

# 烟花粒子类
class FireworkParticle(turtle.Turtle):
    def __init__(self, x, y, color):
        turtle.Turtle.__init__(self)
        self.penup()
        self.goto(x, y)
        self.shape("circle")
        self.color(color)
        self.shapesize(stretch_len=0.2, stretch_wid=0.2)
        self.speed(0)
        self.vx = random.randint(-10, 10)
        self.vy = random.randint(10, 20)
        self.gravity = 0.1

    def move(self):
        self.vy -= self.gravity
        self.setx(self.xcor() + self.vx)
        self.sety(self.ycor() + self.vy)
        if self.ycor() < -300:
            self.hideturtle()

# 烟花类
class Firework(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("circle")
        self.color(random.choice(colors))
        self.shapesize(stretch_len=0.5, stretch_wid=0.5)
        self.speed(0)
        self.goto(random.randint(-380, 380), -300)
        self.vy = random.randint(15, 25)
        self.particles = []

    def launch(self):
        self.sety(self.ycor() + self.vy)
        if self.ycor() > random.randint(100, 200):
            self.explode()

    def explode(self):
        color = random.choice(colors)
        for _ in range(30):
            particle = FireworkParticle(self.xcor(), self.ycor(), color)
            self.particles.append(particle)
        self.hideturtle()

    def update_particles(self):
        for particle in self.particles[:]:
            particle.move()
            if particle.isvisible() == False:
                self.particles.remove(particle)

# 祝福语类
class Greeting(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.hideturtle()
        self.color("white")
        self.goto(0, -200)
        self.font = ("Arial", 30, "bold")
        self.greetings = [
            "新年快乐!",
            "愿新的一年,生活如诗如画!",
            "阖家团圆,幸福安康!",
            "事业蒸蒸日上,财源滚滚来!",
            "学业进步,梦想成真!",
            "身体健康,万事顺遂!"
        ]
        self.index = 0

    def display_greeting(self):
        self.clear()
        self.write(self.greetings[self.index], align="center", font=self.font)
        self.index = (self.index + 1) % len(self.greetings)

# 绘制灯笼函数
def draw_lantern(x, y):
    lantern = turtle.Turtle()
    lantern.penup()
    lantern.goto(x, y)
    lantern.pendown()
    lantern.color("red")
    lantern.begin_fill()
    lantern.circle(30)
    lantern.end_fill()
    lantern.penup()
    lantern.goto(x, y - 30)
    lantern.pendown()
    lantern.color("yellow")
    lantern.pensize(5)
    lantern.right(90)
    for _ in range(6):
        lantern.forward(20)
        lantern.backward(20)
        lantern.left(60)

# 绘制春联函数
def draw_couplet():
    couplet_left = turtle.Turtle()
    couplet_left.penup()
    couplet_left.goto(-350, 200)
    couplet_left.pendown()
    couplet_left.color("red")
    couplet_left.pensize(20)
    couplet_left.goto(-350, -200)

    couplet_right = turtle.Turtle()
    couplet_right.penup()
    couplet_right.goto(350, 200)
    couplet_right.pendown()
    couplet_right.color("red")
    couplet_right.pensize(20)
    couplet_right.goto(350, -200)

    text_left = turtle.Turtle()
    text_left.penup()
    text_left.goto(-350, 150)
    text_left.pendown()
    text_left.color("gold")
    text_left.write("一帆风顺吉星到", align="center", font=("Arial", 20, "bold"))
    text_left.penup()
    text_left.goto(-350, 100)
    text_left.pendown()
    text_left.write("万事如意福临门", align="center", font=("Arial", 20, "bold"))

    text_right = turtle.Turtle()
    text_right.penup()
    text_right.goto(350, 150)
    text_right.pendown()
    text_right.color("gold")
    text_right.write("一帆风顺年年好", align="center", font=("Arial", 20, "bold"))
    text_right.penup()
    text_right.goto(350, 100)
    text_right.pendown()
    text_right.write("万事如意步步高", align="center", font=("Arial", 20, "bold"))

    horizontal = turtle.Turtle()
    horizontal.penup()
    horizontal.goto(0, 250)
    horizontal.pendown()
    horizontal.color("red")
    horizontal.pensize(20)
    horizontal.goto(0, 220)

    text_horizontal = turtle.Turtle()
    text_horizontal.penup()
    text_horizontal.goto(0, 230)
    text_horizontal.pendown()
    text_horizontal.color("gold")
    text_horizontal.write("五福临门", align="center", font=("Arial", 20, "bold"))

# 绘制雪花函数
class Snowflake(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("circle")
        self.color("white")
        self.shapesize(stretch_len=0.1, stretch_wid=0.1)
        self.speed(0)
        self.goto(random.randint(-380, 380), 300)
        self.vy = random.randint(1, 3)

    def fall(self):
        self.sety(self.ycor() - self.vy)
        if self.ycor() < -300:
            self.goto(random.randint(-380, 380), 300)

# 主函数
def main():
    # 绘制灯笼
    draw_lantern(-200, 200)
    draw_lantern(200, 200)

    # 绘制春联
    draw_couplet()

    # 创建倒计时对象
    countdown = Countdown()

    # 创建烟花列表
    fireworks = []

    # 创建祝福语对象
    greeting = Greeting()

    # 创建雪花列表
    snowflakes = []
    for _ in range(50):
        snowflake = Snowflake()
        snowflakes.append(snowflake)

    # 倒计时
    for i in range(10, 0, -1):
        countdown.countdown_display(i)
        wn.update()
        time.sleep(1)

    countdown.clear()
    countdown.write("新年快乐!", align="center", font=("Arial", 80, "bold"))

    # 主循环
    while True:
        wn.update()

        # 随机发射烟花
        if random.random() < 0.02:
            firework = Firework()
            fireworks.append(firework)

        # 更新烟花状态
        for firework in fireworks[:]:
            if firework.isvisible():
                firework.launch()
            else:
                firework.update_particles()
                if len(firework.particles) == 0:
                    fireworks.remove(firework)

        # 滚动祝福语
        if random.random() < 0.01:
            greeting.display_greeting()

        # 更新雪花状态
        for snowflake in snowflakes:
            snowflake.fall()

        time.sleep(0.01)

if __name__ == "__main__":
    main()
#该代码由AI生成

2.0版本(新更新鼠标燃放烟火)

import turtle
import time
import random
import math

# 设置窗口
wn = turtle.Screen()
wn.title("新年快乐!")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)

# 定义颜色列表
colors = ["red", "orange", "yellow", "green", "blue", "purple", "pink"]

# 倒计时类
class Countdown(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.hideturtle()
        self.color("white")
        self.goto(0, 250)
        self.font = ("Arial", 80, "bold")

    def countdown_display(self, seconds):
        self.clear()
        self.write(f"{seconds}", align="center", font=self.font)

# 烟花粒子类
class FireworkParticle(turtle.Turtle):
    def __init__(self, x, y, color):
        turtle.Turtle.__init__(self)
        self.penup()
        self.goto(x, y)
        self.shape("circle")
        self.color(color)
        self.shapesize(stretch_len=0.2, stretch_wid=0.2)
        self.speed(0)
        self.vx = random.randint(-10, 10)
        self.vy = random.randint(10, 20)
        self.gravity = 0.1

    def move(self):
        self.vy -= self.gravity
        self.setx(self.xcor() + self.vx)
        self.sety(self.ycor() + self.vy)
        if self.ycor() < -300:
            self.hideturtle()

# 烟花类
class Firework(turtle.Turtle):
    def __init__(self, x):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("circle")
        self.color(random.choice(colors))
        self.shapesize(stretch_len=0.5, stretch_wid=0.5)
        self.speed(0)
        self.goto(x, -300)
        self.vy = random.randint(15, 25)
        self.particles = []

    def launch(self):
        self.sety(self.ycor() + self.vy)
        if self.ycor() > random.randint(100, 200):
            self.explode()

    def explode(self):
        color = random.choice(colors)
        for _ in range(30):
            particle = FireworkParticle(self.xcor(), self.ycor(), color)
            self.particles.append(particle)
        self.hideturtle()

    def update_particles(self):
        for particle in self.particles[:]:
            particle.move()
            if particle.isvisible() == False:
                self.particles.remove(particle)

# 祝福语类
class Greeting(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.hideturtle()
        self.color("white")
        self.goto(0, -200)
        self.font = ("Arial", 30, "bold")
        self.greetings = [
            "新年快乐!",
            "愿新的一年,生活如诗如画!",
            "阖家团圆,幸福安康!",
            "事业蒸蒸日上,财源滚滚来!",
            "学业进步,梦想成真!",
            "身体健康,万事顺遂!"
        ]
        self.index = 0

    def display_greeting(self):
        self.clear()
        self.write(self.greetings[self.index], align="center", font=self.font)
        self.index = (self.index + 1) % len(self.greetings)

# 绘制灯笼函数
def draw_lantern(x, y):
    lantern = turtle.Turtle()
    lantern.penup()
    lantern.goto(x, y)
    lantern.pendown()
    lantern.color("red")
    lantern.begin_fill()
    lantern.circle(30)
    lantern.end_fill()
    lantern.penup()
    lantern.goto(x, y - 30)
    lantern.pendown()
    lantern.color("yellow")
    lantern.pensize(5)
    lantern.right(90)
    for _ in range(6):
        lantern.forward(20)
        lantern.backward(20)
        lantern.left(60)

# 绘制春联函数
def draw_couplet():
    couplet_left = turtle.Turtle()
    couplet_left.penup()
    couplet_left.goto(-350, 200)
    couplet_left.pendown()
    couplet_left.color("red")
    couplet_left.pensize(20)
    couplet_left.goto(-350, -200)

    couplet_right = turtle.Turtle()
    couplet_right.penup()
    couplet_right.goto(350, 200)
    couplet_right.pendown()
    couplet_right.color("red")
    couplet_right.pensize(20)
    couplet_right.goto(350, -200)

    text_left = turtle.Turtle()
    text_left.penup()
    text_left.goto(-350, 150)
    text_left.pendown()
    text_left.color("gold")
    text_left.write("一帆风顺吉星到", align="center", font=("Arial", 20, "bold"))
    text_left.penup()
    text_left.goto(-350, 100)
    text_left.pendown()
    text_left.write("万事如意福临门", align="center", font=("Arial", 20, "bold"))

    text_right = turtle.Turtle()
    text_right.penup()
    text_right.goto(350, 150)
    text_right.pendown()
    text_right.color("gold")
    text_right.write("一帆风顺年年好", align="center", font=("Arial", 20, "bold"))
    text_right.penup()
    text_right.goto(350, 100)
    text_right.pendown()
    text_right.write("万事如意步步高", align="center", font=("Arial", 20, "bold"))

    horizontal = turtle.Turtle()
    horizontal.penup()
    horizontal.goto(0, 250)
    horizontal.pendown()
    horizontal.color("red")
    horizontal.pensize(20)
    horizontal.goto(0, 220)

    text_horizontal = turtle.Turtle()
    text_horizontal.penup()
    text_horizontal.goto(0, 230)
    text_horizontal.pendown()
    text_horizontal.color("gold")
    text_horizontal.write("五福临门", align="center", font=("Arial", 20, "bold"))

# 绘制雪花函数
class Snowflake(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("circle")
        self.color("white")
        self.shapesize(stretch_len=0.1, stretch_wid=0.1)
        self.speed(0)
        self.goto(random.randint(-380, 380), 300)
        self.vy = random.randint(1, 3)

    def fall(self):
        self.sety(self.ycor() - self.vy)
        if self.ycor() < -300:
            self.goto(random.randint(-380, 380), 300)

# 点击鼠标放烟花函数
def click_to_fire(x, y):
    firework = Firework(x)
    fireworks.append(firework)

# 主函数
def main():
    global fireworks
    # 绘制灯笼
    draw_lantern(-200, 200)
    draw_lantern(200, 200)

    # 绘制春联
    draw_couplet()

    # 创建倒计时对象
    countdown = Countdown()

    # 创建烟花列表
    fireworks = []

    # 创建祝福语对象
    greeting = Greeting()

    # 创建雪花列表
    snowflakes = []
    for _ in range(50):
        snowflake = Snowflake()
        snowflakes.append(snowflake)

    # 倒计时
    for i in range(10, 0, -1):
        countdown.countdown_display(i)
        wn.update()
        time.sleep(1)

    countdown.clear()
    countdown.write("新年快乐!", align="center", font=("Arial", 80, "bold"))

    # 绑定鼠标点击事件
    wn.onscreenclick(click_to_fire)

    # 主循环
    while True:
        wn.update()

        # 随机发射烟花
        if random.random() < 0.02:
            firework = Firework(random.randint(-380, 380))
            fireworks.append(firework)

        # 更新烟花状态
        for firework in fireworks[:]:
            if firework.isvisible():
                firework.launch()
            else:
                firework.update_particles()
                if len(firework.particles) == 0:
                    fireworks.remove(firework)

        # 滚动祝福语
        if random.random() < 0.01:
            greeting.display_greeting()

        # 更新雪花状态
        for snowflake in snowflakes:
            snowflake.fall()

        time.sleep(0.01)

if __name__ == "__main__":
    main()

🔽🔽🔽
都看到这了,稍稍做个广告吧黑客之都聊天区,欢迎加入!

3.0版本(更新红包雨)

import turtle
import time
import random
import math

# 设置窗口
wn = turtle.Screen()
wn.title("新年快乐!")
wn.bgcolor("black")
wn.setup(width=800, height=600)
wn.tracer(0)

# 定义颜色列表
colors = ["red", "orange", "yellow", "green", "blue", "purple", "pink"]

# 倒计时类
class Countdown(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.hideturtle()
        self.color("white")
        self.goto(0, 250)
        self.font = ("Arial", 80, "bold")

    def countdown_display(self, seconds):
        self.clear()
        self.write(f"{seconds}", align="center", font=self.font)

# 烟花粒子类
class FireworkParticle(turtle.Turtle):
    def __init__(self, x, y, color):
        turtle.Turtle.__init__(self)
        self.penup()
        self.goto(x, y)
        self.shape("circle")
        self.color(color)
        self.shapesize(stretch_len=0.2, stretch_wid=0.2)
        self.speed(0)
        self.vx = random.randint(-10, 10)
        self.vy = random.randint(10, 20)
        self.gravity = 0.1

    def move(self):
        self.vy -= self.gravity
        self.setx(self.xcor() + self.vx)
        self.sety(self.ycor() + self.vy)
        if self.ycor() < -300:
            self.hideturtle()

# 烟花类
class Firework(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("circle")
        self.color(random.choice(colors))
        self.shapesize(stretch_len=0.5, stretch_wid=0.5)
        self.speed(0)
        self.goto(random.randint(-380, 380), -300)
        self.vy = random.randint(15, 25)
        self.particles = []

    def launch(self):
        self.sety(self.ycor() + self.vy)
        if self.ycor() > random.randint(100, 200):
            self.explode()

    def explode(self):
        color = random.choice(colors)
        for _ in range(30):
            particle = FireworkParticle(self.xcor(), self.ycor(), color)
            self.particles.append(particle)
        self.hideturtle()

    def update_particles(self):
        for particle in self.particles[:]:
            particle.move()
            if particle.isvisible() == False:
                self.particles.remove(particle)

# 祝福语类
class Greeting(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.hideturtle()
        self.color("white")
        self.goto(0, -200)
        self.font = ("Arial", 30, "bold")
        self.greetings = [
            "新年快乐!",
            "愿新的一年,生活如诗如画!",
            "阖家团圆,幸福安康!",
            "事业蒸蒸日上,财源滚滚来!",
            "学业进步,梦想成真!",
            "身体健康,万事顺遂!"
        ]
        self.index = 0

    def display_greeting(self):
        self.clear()
        self.write(self.greetings[self.index], align="center", font=self.font)
        self.index = (self.index + 1) % len(self.greetings)

# 绘制灯笼函数
def draw_lantern(x, y):
    lantern = turtle.Turtle()
    lantern.penup()
    lantern.goto(x, y)
    lantern.pendown()
    lantern.color("red")
    lantern.begin_fill()
    lantern.circle(30)
    lantern.end_fill()
    lantern.penup()
    lantern.goto(x, y - 30)
    lantern.pendown()
    lantern.color("yellow")
    lantern.pensize(5)
    lantern.right(90)
    for _ in range(6):
        lantern.forward(20)
        lantern.backward(20)
        lantern.left(60)

# 绘制春联函数
def draw_couplet():
    couplet_left = turtle.Turtle()
    couplet_left.penup()
    couplet_left.goto(-350, 200)
    couplet_left.pendown()
    couplet_left.color("red")
    couplet_left.pensize(20)
    couplet_left.goto(-350, -200)

    couplet_right = turtle.Turtle()
    couplet_right.penup()
    couplet_right.goto(350, 200)
    couplet_right.pendown()
    couplet_right.color("red")
    couplet_right.pensize(20)
    couplet_right.goto(350, -200)

    text_left = turtle.Turtle()
    text_left.penup()
    text_left.goto(-350, 150)
    text_left.pendown()
    text_left.color("gold")
    text_left.write("一帆风顺吉星到", align="center", font=("Arial", 20, "bold"))
    text_left.penup()
    text_left.goto(-350, 100)
    text_left.pendown()
    text_left.write("万事如意福临门", align="center", font=("Arial", 20, "bold"))

    text_right = turtle.Turtle()
    text_right.penup()
    text_right.goto(350, 150)
    text_right.pendown()
    text_right.color("gold")
    text_right.write("一帆风顺年年好", align="center", font=("Arial", 20, "bold"))
    text_right.penup()
    text_right.goto(350, 100)
    text_right.pendown()
    text_right.write("万事如意步步高", align="center", font=("Arial", 20, "bold"))

    horizontal = turtle.Turtle()
    horizontal.penup()
    horizontal.goto(0, 250)
    horizontal.pendown()
    horizontal.color("red")
    horizontal.pensize(20)
    horizontal.goto(0, 220)

    text_horizontal = turtle.Turtle()
    text_horizontal.penup()
    text_horizontal.goto(0, 230)
    text_horizontal.pendown()
    text_horizontal.color("gold")
    text_horizontal.write("五福临门", align="center", font=("Arial", 20, "bold"))

# 绘制雪花函数
class Snowflake(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("circle")
        self.color("white")
        self.shapesize(stretch_len=0.1, stretch_wid=0.1)
        self.speed(0)
        self.goto(random.randint(-380, 380), 300)
        self.vy = random.randint(1, 3)

    def fall(self):
        self.sety(self.ycor() - self.vy)
        if self.ycor() < -300:
            self.goto(random.randint(-380, 380), 300)

# 红包类
class RedEnvelope(turtle.Turtle):
    def __init__(self):
        turtle.Turtle.__init__(self)
        self.penup()
        self.shape("square")
        self.color("red")
        self.shapesize(stretch_len=1, stretch_wid=1.5)
        self.speed(0)
        self.goto(random.randint(-380, 380), 300)
        self.vy = random.randint(1, 3)
        self.opened = False

    def fall(self):
        self.sety(self.ycor() - self.vy)
        if self.ycor() < -300:
            self.goto(random.randint(-380, 380), 300)

    def open_envelope(self):
        if not self.opened:
            self.opened = True
            self.hideturtle()
            # 打开红包后放一个烟花
            firework = Firework()
            firework.goto(self.xcor(), self.ycor())
            fireworks.append(firework)
            # 显示祝福语
            greeting.display_greeting()

# 点击鼠标放烟花
def click_to_fire(x, y):
    firework = Firework()
    firework.goto(x, y - 300)
    fireworks.append(firework)

# 主函数
def main():
    # 绘制灯笼
    draw_lantern(-200, 200)
    draw_lantern(200, 200)

    # 绘制春联
    draw_couplet()

    # 创建倒计时对象
    countdown = Countdown()

    # 创建烟花列表
    global fireworks
    fireworks = []

    # 创建祝福语对象
    global greeting
    greeting = Greeting()

    # 创建雪花列表
    snowflakes = []
    for _ in range(50):
        snowflake = Snowflake()
        snowflakes.append(snowflake)

    # 创建红包列表
    red_envelopes = []
    for _ in range(20):
        red_envelope = RedEnvelope()
        red_envelopes.append(red_envelope)
        red_envelope.onclick(red_envelope.open_envelope)

    # 绑定鼠标点击事件
    wn.onscreenclick(click_to_fire)

    # 倒计时
    for i in range(10, 0, -1):
        countdown.countdown_display(i)
        wn.update()
        time.sleep(1)

    countdown.clear()
    countdown.write("新年快乐!", align="center", font=("Arial", 80, "bold"))

    # 主循环
    while True:
        wn.update()

        # 随机发射烟花
        if random.random() < 0.02:
            firework = Firework()
            fireworks.append(firework)

        # 更新烟花状态
        for firework in fireworks[:]:
            if firework.isvisible():
                firework.launch()
            else:
                firework.update_particles()
                if len(firework.particles) == 0:
                    fireworks.remove(firework)

        # 滚动祝福语
        if random.random() < 0.01:
            greeting.display_greeting()

        # 更新雪花状态
        for snowflake in snowflakes:
            snowflake.fall()

        # 更新红包状态
        for red_envelope in red_envelopes:
            red_envelope.fall()

        time.sleep(0.01)

if __name__ == "__main__":
    main()

1.0版本,小品

import time

# 定义角色类
class Character:
    def __init__(self, name):
        self.name = name

    def speak(self, line):
        print(f"{self.name}: {line}")
        time.sleep(1)  # 模拟说话间隔

# 定义小品类
class NewYearSketch:
    def __init__(self):
        # 初始化角色
        self.grandpa = Character("爷爷")
        self.grandma = Character("奶奶")
        self.father = Character("爸爸")
        self.mother = Character("妈妈")
        self.child = Character("孩子")

    def act_scene_1(self):
        print("场景 1: 新年团聚开场")
        self.grandpa.speak("哟呵,孩子们都回来啦,这新年啊,就得热热闹闹的!")
        self.grandma.speak("就是就是,快过来让奶奶看看,都瘦了没。")
        self.father.speak("爸,妈,我们这一大家子啊,新年肯定过得红红火火!")
        self.mother.speak("是啊,都准备好过年的东西啦,就等着好好乐呵乐呵。")
        self.child.speak("爷爷奶奶,我给你们拜年啦,红包拿来!")
        self.grandpa.speak("哟,小家伙嘴真甜,红包肯定有,不过得先给爷爷奶奶表演个节目。")

    def act_scene_2(self):
        print("\n场景 2: 孩子表演节目")
        self.child.speak("那我给大家唱首歌,《新年好》!新年好呀,新年好呀,祝福大家新年好……")
        self.child.speak("哎呀,唱跑调了,嘿嘿。")
        self.grandma.speak("哈哈哈,小家伙唱得真带劲,就是这调儿有点飘,不过开心就好。")
        self.grandpa.speak("行啦行啦,唱得不错,来,这红包拿着。")
        self.child.speak("谢谢爷爷!我要去买好多好吃的。")
        self.father.speak("你这小馋猫,可别光想着吃,也得买点学习用品。")
        self.child.speak("知道啦知道啦,爸爸真啰嗦。")

    def act_scene_3(self):
        print("\n场景 3: 准备年夜饭")
        self.mother.speak("老头子,老婆子,我和孩子他爸去准备年夜饭,你们就坐着歇会儿。")
        self.grandpa.speak("行,你们去忙吧,我和**就等着吃啦。")
        self.father.speak("今天我露一手,给大家做个拿手菜——红烧排骨。")
        self.mother.speak("那我来炒个青菜,再熬个汤。")
        self.child.speak("我也来帮忙,我来洗菜。")
        time.sleep(2)  # 模拟准备时间
        self.father.speak("哎呀,这排骨怎么这么难切,我这刀工退步了。")
        self.mother.speak("你就别逞强了,让我来。")
        self.child.speak("妈妈小心手哦,我来给你加油。")
        self.father.speak("哼,我就不信切不好这排骨。")
        time.sleep(2)
        self.father.speak("哎哟,差点切到手指,还好反应快。")
        self.mother.speak("你看看你,就不听劝,以后别瞎逞能了。")

    def act_scene_4(self):
        print("\n场景 4: 年夜饭风波")
        self.mother.speak("开饭啦,大家快来尝尝我和你爸的手艺。")
        self.grandpa.speak("哟,这菜看着色香味俱全啊,我可得好好尝尝。")
        self.grandma.speak("先尝尝这青菜,绿油油的,肯定好吃。")
        self.father.speak("大家先尝尝我做的红烧排骨。")
        self.child.speak("哇,排骨看着就香,我先吃一块。")
        time.sleep(1)
        self.child.speak("爸爸,你这排骨怎么有点咸啊。")
        self.father.speak("啊?不会吧,我明明放了适量的盐啊。")
        self.grandma.speak("没事没事,可能口味重了点,多吃点菜就中和了。")
        self.mother.speak("来,尝尝我炒的青菜,清淡爽口。")
        self.grandpa.speak("嗯,这青菜炒得不错,火候刚刚好。")
        self.child.speak("妈妈做的菜就是好吃,爸爸你要多跟妈妈学学。")
        self.father.speak("哼,下次我一定做出更好吃的排骨。")

    def act_scene_5(self):
        print("\n场景 5: 看春晚抢红包")
        self.grandpa.speak("吃完年夜饭,咱们一起看春晚吧,这可是新年的传统。")
        self.family = [self.grandpa, self.grandma, self.father, self.mother, self.child]
        for person in self.family:
            person.speak("好呀,看春晚去咯。")
        time.sleep(2)
        self.grandpa.speak("哟,春晚开始发红包啦,大家赶紧抢。")
        self.child.speak("我抢我抢,哎呀,没抢到。")
        self.father.speak("我抢到啦,哈哈哈,运气不错。")
        self.mother.speak("我也抢到一点,不多,聊胜于无。")
        self.grandma.speak("哎呀,我这手慢了,没抢到。")
        self.grandpa.speak("没关系,下次还有机会,重在参与嘛。")
        self.child.speak("爸爸,你抢到多少,分我点呗。")
        self.father.speak("你这小家伙,自己没抢到还想分我的,没门。")

    def act_scene_6(self):
        print("\n场景 6: 新年许愿")
        self.grandpa.speak("新的一年就要到啦,咱们每个人都许个愿吧。")
        self.grandma.speak("我希望咱们一家人平平安安,健健康康的。")
        self.father.speak("我希望工作顺利,能多赚点钱,让家里日子过得更好。")
        self.mother.speak("我希望孩子学习进步,快乐成长。")
        self.child.speak("我希望能有好多好多玩具,还能天天吃好吃的。")
        self.grandpa.speak("好呀,大家的愿望都很美好,希望新的一年都能实现。")

    def act_scene_7(self):
        print("\n场景 7: 放鞭炮")
        self.child.speak("爷爷,咱们去放鞭炮吧,新年放鞭炮可热闹啦。")
        self.grandpa.speak("好嘞,走,咱们去放鞭炮。")
        self.father.speak("我也去,注意安全啊。")
        time.sleep(2)
        self.child.speak("哇,鞭炮好响啊,真好玩。")
        self.grandpa.speak("哈哈哈,这才有点新年的气氛嘛。")
        self.father.speak("行了行了,别放太多,小心伤着。")
        self.child.speak("知道啦爸爸,我就再放几个。")
        time.sleep(2)
        self.child.speak("哎呀,鞭炮炸到我衣服啦,有点烧焦味。")
        self.father.speak("你看看你,让你小心点,这下好了吧。")
        self.grandpa.speak("没事没事,没伤着人就好,脱下来我看看。")

    def act_scene_8(self):
        print("\n场景 8: 结束")
        self.grandpa.speak("这新年过得可真热闹啊,一家人团团圆圆的,比啥都强。")
        self.grandma.speak("就是就是,希望以后每年都能这样。")
        self.father.speak("爸,妈,你们放心,以后每年新年咱们都一起好好过。")
        self.mother.speak("是啊,一家人在一起,就是最幸福的事。")
        self.child.speak("明年我还要拿更多红包,放更多鞭炮。")
        print("小品结束,祝大家新年快乐!")

    def perform(self):
        self.act_scene_1()
        self.act_scene_2()
        self.act_scene_3()
        self.act_scene_4()
        self.act_scene_5()
        self.act_scene_6()
        self.act_scene_7()
        self.act_scene_8()

# 运行小品
if __name__ == "__main__":
    sketch = NewYearSketch()
    sketch.perform()

您可能感兴趣的与本文相关的镜像

Python3.9

Python3.9

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

༺ཌༀ傲穹_Vortexༀད༻

你的鼓励奖是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值