用户:
Mr.Python查看:0 回复:1 评论:0 创建时间:2021-05-05T21:25:32
【作品展示】

【作品介绍】
内容可能有点水,但绝对是用心的!绘图可能有点慢,请耐心等待!
纯turtle!
【作品源代码】
import turtle as t
import random as r
t.speed(0)
t.bgcolor('black')
def star(t):
x = range(r.randint(100, 500), 0, (-1))
for i in x:
t.penup()
t.goto(r.randint((-1000), 1000), r.randint((-1000), 1000))
t.pendown()
for ii in range(63, 256, 喵):
t.color('#'+('%x' % ii)*3) #将数字转化为十六进制
t.dot((10-int((ii / 喵))*2))
print('第%d/%d个' % (max(x)-i+1, max(x)))
t.penup()
def sun(t):
t.goto(-400,200)
t.pendown()
for i in range(0,256,16):
t.color('#'+('%02x' % i)+('%02x'%round(int(i)*(160/256)))+'00') # 将数字转化为十六进制
t.dot(400-i/2)
t.color('#ffb200')
t.dot(400-i/2)
t.penup()
def earth(t):
t.goto(200,-100)
t.color('#24287e')
t.dot(200)
t.fillcolor('#00ff00')
point = (((95, 8), (117, 41), (146, 37), (156, 47), (163, 62), (192, 56), (233, 56), (224, 41),(200, 22), (180, 9)), ((248, 93), (230, 116), (243, 136), (239, 151), (235, 170), (228, 184), (222, 201),
(227, 209), (238, 188), (246, 170), (250, 127)), ((36, 38), (47, 53), (47, 63), (36, 77), (35, 110), (46, 118), (46, 126), (32, 134), (1, 128), (1, 103), (8, 81), (21, 51)), ((10, 184), (27, 176), (55, 194), (66, 216), (88, 223), (105, 259), (74,250), (45,231), (20,205)))
t.penup()
t.color('#00ff00')
x=0.78
for i in point:
t.begin_fill()
for ii in i:
t.goto(ii[0]*x+100, ii[1]*x-203)
t.pendown()
if i[0]==ii:
t.begin_fill()
t.end_fill()
t.penup()
def hj(t):
t.pensize(5)
t.goto(100,-200)
t.left(30)
t.color('gray')
t.pendown()
t.fillcolor('white')
t.begin_fill()
t.forward(200)
t.right(90)
t.forward(40)
t.right(90)
t.forward(200)
t.right(90)
t.forward(40)
t.forward(20)
t.right(135)
t.forward((20**2*2)**0.5)#运用勾股定理求斜边
t.right(45)
t.penup()
t.forward(40)
t.right(45)
t.forward((20**2*2)**0.5)
t.right(135)
t.forward(60)
t.end_fill()
t.right(90)
t.forward(200)
t.color('darkred')
t.fillcolor('red')
t.pendown()
t.begin_fill()
t.right(30)
t.forward(40)
t.right(120)
t.forward(40)
t.right(120)
t.forward(40)
t.end_fill()
t.penup()
t.right(90)
t.backward(200)
t.pencolor("darkorange")
t.fillcolor("orange")
t.pendown()
t.begin_fill()
t.left(169)
t.forward(20)
t.left(140)
t.forward(20)
t.right(110)
t.forward(25)
t.left(140)
t.forward(25)
t.right(110)
t.forward(20)
t.left(140)
t.forward(20)
t.end_fill()
t.penup()
print('Mr. Python出品,未经允许,严谨抄袭全部或任何部分内容!')
star(t)
sun(t)
earth(t)
hj(t)
t.hideturtle()
t.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn