实验6

from turtle import *
# 绘制正方形
# 参数size指定边长,rgb指定画笔颜色
# 如果没有给参数,采用默认值
def square(size=50, rgb = 'red'):
    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()

  实验6

 

 

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()

  

 

实验6

 

 

from turtle import *
speed(0)
setup(800, 600)
bgcolor('black')
pencolor('yellow')
angle = 0
size = 2
for i in range(10):
    for j in range(4):
        fd(size)
        angle += 72#jiaodu
        seth(angle)
        size += 2
hideturtle()
done()

  实验6

 

 

from random import *
from turtle import*
speed(0)
setup(800,600)
penup()
goto(-200,0)
pendown()
for m in range(20):
    rgb = tuple(random() for i in range(3)) # 随机生成rgb颜色三元组
    color(rgb)
    begin_fill()
    fd(20)
    left(90)
    fd(60)
    left(90)
    fd(20)
    left(90)
    fd(60)
    left(90)
    fd(20)
    end_fill()
hideturtle()
done()

  

实验6

 

 实验6

 

上一篇:RGB与YUV转换以及存储格式


下一篇:【车牌识别】基于matlab RGB车牌识别【含Matlab源码 1108期】