python : turtle 画正六边形 hexagon comb

draw_comb2.py
# -*- coding: cp936 -*-
# 画2圈蜂巢形 hexagon comb
import turtle

window = turtle.Screen()
t=turtle.Pen()

L = 50  # 画线长度
for h in range(6):
    for i in range(6):
        for j in range(6):
            t.forward(L)
            t.right(60)
        t.forward(L)
        t.left(60)
    t.forward(L)
    t.right(60)
#
window.exitonclick()

猜你喜欢

转载自belldeep.iteye.com/blog/2369506