zoukankan      html  css  js  c++  java
  • python海龟画图生成星星

    import turtle  as tt
    import random
    from random import randint
    tt.setup(1280,720)
    tt.bgcolor("black")
    tt.colormode(255)
    tt.speed(0)
    q = 1
    while q <= 1000:
    B = randint(0, 255)
    x = randint(-640, 640)
    y = randint(-360, 360)
    A = randint(0, 255)
    B = randint(0, 255)
    C = randint(0, 255)
    tt.pencolor(A, B, C)
    tt.pu()
    tt.goto(x,y)
    tt.pd()
    a = ['red','yellow','blue','green','pink','purple','pink','white','cyan','gray','coral']
    tt.fillcolor(random.choice(a))
    tt.begin_fill()
    for i in range(6):
    tt.forward(15)
    tt.left(144)
    tt.hideturtle()
    q = q + 1
    tt.end_fill()
    tt.done()


    运行效果图:

    
    
  • 相关阅读:
    Vue自定义指令 directive
    Vue过滤器 filters
    贪心
    家庭作业
    线段
    数列极差
    shell
    智力大冲浪
    加工生产调度
    喷水装置
  • 原文地址:https://www.cnblogs.com/jhxshell/p/14638874.html
Copyright © 2011-2022 走看看