机器人
积分排行榜
Scratch
积分排行榜
Python
在线答题
积分排行榜
活跃排行榜
C++
在线答题
积分排行榜
活跃排行榜
网盘
链接
打字练习
Microbit
未登录
未登录
登录学习
作者:
李冠彤
更新时间:
2024-05-12 11:56
浏览:
200次
点赞:
4次
热度:
20
import turtle import random import tkinter.messagebox screen = turtle.Screen() screen.bgcolor("#C9DDF2") pen = turtle.Turtle() pen.speed(0) pen.hideturtle() pen.penup() pen.goto(-100,0) pen.color("#2C3E50") pen.write("Happy Mother's Day!", font=("Arial", 24, "bold")) pen.penup() pen.goto(100, -100) pen.write("你的儿子李冠彤", font=("Arial", 24, "bold")) # 画出爱心 colors = ["#FFB6C1", "#F08080", "#FFA07A", "#FFC0CB", "#FFDAB9", "#FFE4E1"] for i in range(16): pen.penup() x = random.randint(-360, 360) y = random.randint(-300, 300) pen.goto(x, y) pen.pendown() color = random.choice(colors) pen.color(color) pen.begin_fill() pen.left(45) pen.forward(50) pen.circle(25, 180) pen.right(90) pen.circle(25, 180) pen.forward(50) pen.end_fill() for i in range(16): pen.penup() x = random.randint(-360, 360) y = random.randint(-300, 300) pen.goto(x, y) pen.pendown() color = random.choice(colors) pen.color("pink") pen.begin_fill() pen.dot(15) # 绘制玫瑰 # 设置初始位置 turtle.hideturtle() turtle.penup() turtle.pensize(5) turtle.left(90) turtle.fd(200) turtle.pendown() turtle.right(90) # 花蕊 turtle.fillcolor("red") turtle.begin_fill() turtle.circle(10, 180) turtle.circle(25, 110) turtle.left(50) turtle.circle(60, 45) turtle.circle(20, 170) turtle.right(24) turtle.fd(30) turtle.left(10) turtle.circle(30, 110) turtle.fd(20) turtle.left(40) turtle.circle(90, 70) turtle.circle(30, 150) turtle.right(30) turtle.fd(15) turtle.circle(80, 90) turtle.left(15) turtle.fd(45) turtle.right(165) turtle.fd(20) turtle.left(155) turtle.circle(150, 80) turtle.left(50) turtle.circle(150, 90) turtle.end_fill() # 花瓣1 turtle.left(150) turtle.circle(-90, 70) turtle.left(20) turtle.circle(75, 105) turtle.setheading(60) turtle.circle(80, 98) turtle.circle(-90, 40) # 花瓣2 turtle.left(180) turtle.circle(90, 40) turtle.circle(-80, 98) turtle.setheading(-83) # 叶子1 turtle.fd(30) turtle.left(90) turtle.fd(25) turtle.left(45) turtle.fillcolor("green") turtle.begin_fill() turtle.circle(-80, 90) turtle.right(90) turtle.circle(-80, 90) turtle.end_fill() turtle.right(135) turtle.fd(60) turtle.left(180) turtle.fd(85) turtle.left(90) turtle.fd(80) # 叶子2 turtle.right(90) turtle.right(45) turtle.fillcolor("green") turtle.begin_fill() turtle.circle(80, 90) turtle.left(90) turtle.circle(80, 90) turtle.end_fill() turtle.left(135) turtle.fd(60) turtle.left(180) turtle.fd(60) turtle.right(90) turtle.circle(200, 60) turtle.pendown() # 隐藏画笔 pen.hideturtle() # 弹出提示框 tkinter.messagebox.showinfo(title="Happy Mother's Day!", message="祝妈妈母亲节快乐^_^") # 点击关闭窗口 screen.exitonclick()
点赞成功
分享作品
×