当前位置:   article > 正文

python绘制8×8棋盘_python图形工具turtle绘制国际象棋棋盘

编制一个8行8列的棋盘,棋盘小方格边长为36像素python

本文实例为大家分享了python图形工具turtle绘制国际象棋棋盘的具体代码,供大家参考,具体内容如下

#编写程序绘制一个国际象棋的棋盘

import turtle

turtle.speed(30)

turtle.penup()

off = true

for y in range(-40, 30 + 1, 10):

for x in range(-40, 30 + 1, 10):

if off:

turtle.goto(x, y)

turtle.pendown()

turtle.begin_fill()

turtle.color("black")

turtle.forward(10)

turtle.left(90)

turtle.forward(10)

turtle.left(90)

turtle.forward(10)

turtle.left(90)

turtle.forward(10)

turtle.left(90)

turtle.end_fill()

turtle.penup()

else:

turtle.goto(x, y)

turtle.pendown()

turtle.forward(10)

turtle.left(90)

turtle.forward(10)

turtle.left(90)

turtle.forward(10)

turtle.left(90)

turtle.forward(10)

turtle.left(90)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/167408
推荐阅读
相关标签
  

闽ICP备14008679号