热门

最新

红包

立Flag

投票

同城

我的

发布
huluwajiubaba_
huluwajiubaba_
4 年前
truehuluwajiubaba_

一个 毫无用处的彩色虫
import turtle #导入turtle模块
from random import choice #导入随即模块choice
a=['red','yellow','blue','black','green','pink']

turtle.setup(650,350,200,200) #画布大小
turtle.penup()
turtle.fd(-250)
turtle.pendown()
turtle.pensize(25)

turtle.seth(-50)
for j in range(4):
turtle.pencolor(choice(a)) #随机选取颜色
for i in range(1):
turtle.circle(40,80)
turtle.circle(-40,80)


turtle.circle(40,80/2)
turtle.fd(40)
turtle.circle(16,120)
turtle.fd(40*2/3)
turtle.done()


CSDN App 扫码分享
分享
评论
1
打赏
  • 复制链接
  • 举报
下一条:
冬天到了 ,送大家一个满天星import turtle as t #导入turtle模块from random import choice #导入choice模块t.speed(10000) #画笔速度t.width(1) #宽度t.bgcolor("black") #画布颜色for n in range(100): # color1 = ["red", "blue", "pink", "purple", "green", "yellow"]# color2 = choice(color1) 可以随机选取颜色想要白色可以把这里删掉 t.color("white") #白色画笔 x=list(range(-800,800)) y=list(range(-400,400)) x1=choice(x) y1=choice(y) t.penup() t.goto(x1,y1) t.begin_fill() for i in range(5): #画一个五角星 t.pendown() t.fd(30) t.left(144) t.end_fill() t.right(90)t.done()
立即登录