Python turtle点状图1.0(三角形)
1.0(三角形版本)
from turtle import *
import random
#子程序
#多边形def
def dbx(bs,bc):
a=random.randint(0,255)
b=random.randint(0,255)
c=random.randint(0,255)
colormode(255)
pencolor((a,b,c))
fillcolor((a,b,c))
begin_fill()
for i in range(bs):
fd(bc)
right(360/bs)
end_fill()
#每一行的输出
def hang():
for i in range(10):
dbx(3,20)
up()
fd(30)
pd()
#每一列的输出
def lie():
for i in range(9):
up()
rt(90)
fd(30)
rt(90)
fd(300)
rt(180)
hang()
#主程序
speed(0)
hang()
lie()
hideturtle()
