猫史档案馆


【Python作品分享】【去太空,趣编程】宙探索绘制【作业帖】

用户:NeutrophilsNotNeutrophilsNot查看:0 回复:0 评论:0 创建时间:2021-05-01T12:33:31


【作品展示】

center_image

 

【作品介绍】

此作品参加【去宇宙,趣编程】比赛,用python绘制简单的宇宙,内容包含火星,地球,月球,火箭,金星,太阳和星空,请勿抄袭!!!

希望能获得一个一等奖!

 

【作品源代码】

import turtle
import random
import turtle as t


turtle.bgcolor("#000000")
t.speed(0)
t.pensize(1)
t.pencolor("#ffffff")
for count in range(80):
    t.penup()
    t.goto(random.randint((-300), 300), random.randint((-300), 300))
    t.pendown()
    t.circle(1)
for count in range(20):
    t.penup()
    t.goto(random.randint((-300), 300), random.randint((-300), 300))
    t.pendown()
    t.circle(1, steps=5)

t.penup()
t.goto((-300), (-300))
t.pendown()
t.pencolor("#ff0000")
t.fillcolor("#ff0000")
t.begin_fill()
t.circle(100)
t.end_fill()

t.penup()
t.goto((-50), 0)
t.pendown()
t.pencolor("#3366ff")
t.fillcolor("#3366ff")
t.begin_fill()
t.circle(70)
t.end_fill()

t.penup()
t.goto((-60), 20)
t.pendown()
t.pencolor("#cccccc")
t.fillcolor("#cccccc")
t.begin_fill()
t.circle(20)
t.end_fill()

t.penup()
t.goto(200, 200)
t.pendown()
t.pencolor("#ffcc33")
t.fillcolor("#ffcc66")
t.begin_fill()
t.circle(25)
t.end_fill()

t.penup()
t.goto(300, 260)
t.pendown()
t.fillcolor("#ff0000")
t.pencolor("#ff0000")
t.begin_fill()
t.circle(70)
t.end_fill()

t.pencolor("#ffffff")
t.fillcolor("#ffffff")
t.speed(0)
t.penup()
t.pensize(1)
t.goto(0, 0)
t.pendown()
t.begin_fill()
for __count in range(15):
    t.forward(6)
    t.right((-3))
t.setheading(180)
for __count in range(15):
    t.forward(6)
    t.right((-3))
t.end_fill()
t.penup()
t.goto(0, 0)
t.pendown()
t.begin_fill()
t.setheading((-25))
t.circle(10, steps=3)
t.end_fill()
t.penup()
t.goto(0, 0)
t.pendown()
t.begin_fill()
t.setheading((-90))
t.circle(10, steps=3)
t.end_fill()
t.penup()
t.goto(50, 15)
t.pendown()
t.fillcolor("#ffff00")
t.begin_fill()
t.setheading(0)
t.circle(5)
t.end_fill()

t.pencolor("#ffff66")
t.penup()
t.goto(80, 32)
t.pendown()
t.setheading(32)
t.forward(40)

t.pencolor("#ff0000")
t.fillcolor("#ff0000")
t.penup()
t.goto(0, 0)
t.pendown()
t.begin_fill()
t.setheading(120)
t.circle(15, steps=3)
t.end_fill()
print('去宇宙,趣编程!')
t.hideturtle()
turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页