python绘图

from turtle import *
from random import *
import time
speed(9)
getscreen().colormode(255)

def randomcolor():
      red=randint(0,255)
      green=randint(0,255)
      blue=randint(0,255)
      color(red,green,blue)
def randomplace():
      x=randint(-120,120)
      y=randint(-150,150)
      penup()
      goto(x,y)
      pendown
      
def randomheading():
      setheading(randint(1,360))
def drawcircle():
      dot(randint(1,80))
      
      
shape("turtle")
randomcolor()
randomplace()
for i in range(30):
      randomcolor()
      randomplace()
      randomheading()
      stamp()
      
goto(-150,-200)
write('Waiting a moment...稍等片刻!',72,font="Arial")

time.sleep(3)
clear()
for i in range(30):
      randomcolor()
      randomplace()
      drawcircle()

cnliutz

计算机基础教师

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注