python绘制六角形
import turtle turtle.left(30) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) #在图形旁边添加文字 printer = turtle.Turtle() printer.hideturtle() printer.penup() printer.back(200) printer.write(" 詹曼青", align="center", font=("黑体", 12, "normal"))
效果图: