猫史档案馆


【Python】

用户:伦敦西区肯辛顿富人区名富商大天才煊伦敦西区肯辛顿富人区名富商大天才煊查看:1 回复:5 评论:1 创建时间:2019-02-25T18:57:18


import random
import turtle

t = turtle.Pen()
colors = ['red', 'blue', 'yellow', 'pink', 'green', 'purple', 'orange', 'white']

t.speed(1000)
turtle.bgcolor("black")

def paintbrush(x,y):
    a = random.randint(0, 7)
    b = random.randint(0, 50)
    t.pencolor(colors[a])
    t.fillcolor(colors[a])
    t.penup()
    t.goto(x, y)
    t.pendown()
    t.begin_fill()
    t.circle(b)
    t.end_fill()
    
turtle.onscreenclick(paintbrush)


回复

上一页1 页 / 共 1下一页
阿尔法官方阿尔法官方

原谅我没看的太懂,你这个代码时在屏幕上画带颜色的原片吗

点赞0


评论


海龟本尊2海龟本尊2

一闪而过 看不懂

点赞0


评论


MM疯MM疯

是不是在屏幕上任意点击一个地方就可以在那里画个圆

 

点赞0


评论


星空之忆星空之忆

要在代码最后加上turtle.done()

点赞0


评论


邓D敏M怡Y邓D敏M怡Y

额..........我没看懂

点赞0


评论