用户:
Snail-Python查看:0 回复:0 评论:0 创建时间:2021-05-15T21:07:55
【作品展示】

【作品介绍】
图片中星球上的是天问一号飞机票,它下面的是天问一号。天问一号的下面是地球——也就是飞机票上的出发地。
【作品源代码】
import turtle
mypen = turtle.Pen()
myscreen = turtle.Screen()
myscreen.bgcolor("midnightblue")
width = 600
height = 600
myscreen.setup(width, height)
planet = myscreen.textinput("确定目的地", "请输入你想乘坐天问一号去的星球:")
mypen.penup()
mypen.goto(0, -height / 2 - 200)
mypen.pendown()
mypen.dot(600,"green")
mypen.penup()
mypen.left(90)
mypen.fd(400)
mypen.pendown()
#票
mypen.penup()
mypen.goto(0,150)
mypen.pendown()
mypen.dot(300,"orange")
mypen.penup()
mypen.right(225)
mypen.fd(150)
mypen.pendown()
mypen.pencolor("green")
mypen.write("出发地 目的地\n地球 {}\n2021年5月15日抵达\n航班:天问一号\n已检票".format(planet),font = ("宋体",20))
#go
mypen.penup()
mypen.left(45)
mypen.goto(0,-290)
mypen.pendown()
mypen.pencolor("yellow")
mypen.write("Go!!!",font = ("宋体",30))
#正方形
mypen.penup()
mypen.goto(0, -height / 2 + 200)
mypen.left(90)
mypen.pendown()
mypen.pencolor("yellow")
mypen.fillcolor("yellow")
mypen.left(90)
mypen.begin_fill()
for i in range(5):
mypen.fd(50)
mypen.right(90)
mypen.end_fill()
#三角形
mypen.pencolor("red")
mypen.fillcolor("red")
mypen.begin_fill()
for i in range(3):
mypen.fd(50)
mypen.left(360 / 3)
mypen.end_fill()
#左机翼
mypen.right(90)
mypen.pencolor("yellow")
mypen.fd(25)
mypen.right(90)
mypen.fillcolor("white")
mypen.fd(25)
def wing():
mypen.right(90)
mypen.begin_fill()
mypen.fd(25)
mypen.left(90)
mypen.fd(150)
mypen.left(90)
mypen.fd(50)
mypen.left(90)
mypen.fd(150)
mypen.left(90)
mypen.fd(25)
mypen.end_fill()
wing()
#右机翼
mypen.right(90)
mypen.fd(100)
wing()
mypen.hideturtle()
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn