import turtle as t
**#2. 创建背景**
game = t.Screen()
game.title("打乒乓")
game.bgcolor("black")
game.setup(800,600)
game.tracer(0)
#3. 创建球拍
xm = t.Turtle()
xm.ht() #先隐藏
xm.up()
xm.speed(0)
xm.color('yellow')
xm.shape('square')
xm.shapesize(5, 1)
xm.goto(-350, 0)
xm.st() #再显示
#5. 创建如花
ruhua = t.Turtle()
ruhua.ht() #先隐藏
ruhua.up()
ruhua.speed(0)
ruhua.color('white')
ruhua.shape('square'</
python编写打乒乓球小游戏
最新推荐文章于 2024-03-20 12:29:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)