赞
踩
# !/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:wxh
def run():
'''
主方法
:return: None
'''
import turtle
length = 150 # 线段长度
angle = 45 # 角度
offset_angle = 10 # 每次偏移的角度
turtle.screensize(800, 800)
turtle.bgcolor('blue')
def draw():
'循环画方框'
turtle.forward(length)
turtle.right(angle)
turtle.forward(length)
turtle.right(180 - angle)
turtle.forward(length)
turtle.right(angle)
turtle.forward(length)
turtle.right(180 - angle)
turtle.right(offset_angle)
turtle.penup()
turtle.goto(0, -400)
turtle.left(90)
turtle.pendown()
turtle.pencolor('gold')
turtle.forward(length * 3)
turtle.left(180)
for i in range(36):
draw()
turtle.hideturtle() # 隐藏画笔
turtle.done()
if __name__ == '__main__':
run()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。