.DokiDoki

导航

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"))

效果图:

posted on 2020-09-15 22:42  .DokiDoki  阅读(579)  评论(0编辑  收藏  举报