实验六

task3

from turtle import *
def square(size=50,rgb='pink'):
    pencolor(rgb)
    for i in range(4):
        fd(size)
        left(90)
def main():
    setup(800,600)
    speed(0)

    for i in range(10):
        square(80)
        left(36)

    hideturtle()
    done()

if __name__=='__main__':
    main()

 实验六

 

 

 task4

 

from turtle import *

setup(800,600)
pencolor('orange')

for i in range(10):
    for i in range(2):
        circle(80,90)
        left(90)

    right(36)

hideturtle()
done()

  实验六

 

 task5

from turtle import *

setup(800,600)
speed(0)
pencolor('red')
bgcolor('black')

angle=0
size=2

for i in range(8):
    for i in range(5):
        fd(size)
        angle+=72
        seth(angle)
        size+=5

hideturtle()
done()

  

实验六

 

 task6

from turtle import *
from random import random

def rect(rgb):
    color(rgb)
    begin_fill()
    for i in range(2):
        fd(20)
        left(90)
        fd(80)
        left(90)
    end_fill()

def moveto(x,y):
    penup()
    goto(x,y)
    pendown()

def main():
    setup(800,600)
    speed(0)

    for i in range(20):

        moveto(180-20*i,0)
        rgb = tuple(random() for i in range(3))
        rect(rgb)
    hideturtle()
    done()
if __name__=='__main__':
    main()

  

实验六

 

上一篇:【图像识别】基于RGB和BP神经网络的人民币识别系统含GUI界面


下一篇:颜色单位