首页 > 其他分享 >绘制正方形

绘制正方形

时间:2022-10-14 19:56:03浏览次数:39  
标签:填充 190 正方形 fd 设置 188 绘制 fill

import turtle as t
t.speed(1)     #设置执行每一次时间为1秒
t.fillcolor("red") #设置填充颜色为红色

t.begin_fill()  #设置填充的起始位置
t.ht() #隐藏画笔
t.fd(188)  #当前方向走188像素forward
t.lt(90)      #左走走90像素left
t.fd(190)  #向前走190
t.goto(0,0)     #回到起点(0,0)

t.end_fill()    #设置填充的结束位置
t.ht() #隐藏画笔hideturtle
t.fillcolor("yellow") #设置填充颜色为黄色
t.begin_fill()  #设置填充的起始位置

t.fd(188)  #向前走188
t.rt(90)      #向左走90right
t.fd(190)  #向前走190
t.goto(0,0)     #回到起点(0,0)

t.end_fill()    #设置填充的结束位置

标签:填充,190,正方形,fd,设置,188,绘制,fill
From: https://www.cnblogs.com/JK8395/p/16792811.html

相关文章