sairate 2cd753d3d9 feat(第7讲 字母卡牌): 实现记忆游戏并添加开始界面
- 新增 jiyi.py 文件,实现字母翻牌记忆游戏功能
- 添加 youxijiemian.py 文件,创建游戏开始界面
- 使用 turtle 和 tkinter 模块分别实现游戏和界面
- 支持选择不同难度的游戏模式
2025-06-29 09:06:19 +08:00

73 lines
1.3 KiB
Python

#请在这里编写代码
from turtle import *
import time
tracer(0)
screen = Screen() # 创建窗口
screen.bgpic("sun.png") # 设置背景
screen.setup(1000, 800) # 设置窗口大小
register_shape("水星.gif")
mercury = Turtle()
mercury.shape("水星.gif")
mercury.penup()
register_shape("金星.gif")
gold = Turtle()
gold.shape("金星.gif")
gold.penup()
register_shape("地球.gif")
earth =Turtle()
earth.shape("地球.gif")
earth.penup()
register_shape("火星.gif")
mars = Turtle()
mars.shape("火星.gif")
mars.penup()
mars.goto(0,-180)
register_shape("木星.gif")
mu = Turtle()
mu.shape("木星.gif")
mu.penup()
mu.goto(0,-220)
register_shape("土星.gif")
tu = Turtle()
tu.shape("土星.gif")
tu.penup()
tu.goto(0,-270)
register_shape("天王星.gif")
tian = Turtle()
tian.shape("天王星.gif")
tian.penup()
tian.goto(0,-320)
register_shape("海王星.gif")
hai = Turtle()
hai.shape("海王星.gif")
hai.penup()
hai.goto(0,-380)
mercury.goto(0, -70)
gold.goto(0, -100)
earth.goto(0, -140)
while True:
mercury.circle(70, 360 / 88)
gold.circle(100, 360 / 365)
earth.circle(140, 360 / 224)
mars.circle(180, 360 / 450)
mu.circle(220, 360 / 500)
tu.circle(270, 360 / 600)
tian.circle(320, 360 / 700)
hai.circle(380, 360 / 800)
update() # 刷新屏幕
time.sleep(0.01)