【无标题】利用Python画图画房子

直接上代码【吃瓜】

觉得丑的话可以自己调一下

turtle as t
t.pensize(2)
t.speed(1)     #设置画画的速率
t.colormode(255)
t.pencolor("black")
t.begin_fill()
#房顶
t.fillcolor(0,245,255)
for i in range(3):
    t.forward(240)
    t.left(120)
t.end_fill()
#房顶阁楼窗户外框
t.penup()
t.goto(80,20)
t.pendown()
t.begin_fill()
t.fillcolor("white")
for i in range(4):
    t.forward(80)
    t.left(90)
t.end_fill()
#阁楼窗户内部的横线
t.penup()
t.goto(80,60)
t.pendown()
t.forward(80)
#阁楼窗户内部的竖线
t.penup()
t.goto(120,100)
t.pendown()
t.right(90)
t.forward(80)
t.right(90)
t.forward(80)
#房屋主体
t.left(90)
t.penup()
t.goto(0,0)
t.pendown()
t.begin_fill()
t.fillcolor(255,165,0)
for i in range(2):
    t.forward(240)
    t.left(90)
    t.forward(240)
    t.left(90)
t.end_fill()
#屋门
t.penup()
t.goto(30,-180)
t.pendown()
t.begin_fill()
t.fillcolor("blue")
for i in range(2):
    t.forward(50)
    t.left(90)
    t.forward(100)
    t.left(90)
t.end_fill()
#窗框
t.penup()
t.goto(140,-90)
t.pendown()
t.begin_fill()
t.fillcolor("white")
for i in range(4):
    t.forward(70)
    t.left(90)
t.end_fill()
#窗户上的竖线
t.penup()
t.goto(175,-90)
t.pendown()
t.left(90)
t.forward(70)
t.hideturtle()

  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值