python做的小房子

简单的小房子🏠


import turtle as t
t.setup(1000,600)#
t.bgcolor('azure')#lightyellow/aqua
t.penup()t.goto(-100,0)t.speed(8)
t.pendown ()t.pencolor('brown')#画三角形和矩形t.fillcolor('yellow')
t.begin_fill()t.fd(200)
t.goto(0,190)
t.goto(-100,0)
t.end_fill()#矩形
t.fillcolor('forestgreen')
t.begin_fill()
t.goto(-100,-200)
t.goto(100,-200)
t.goto(100,0)
t.goto(-100,0)
t.goto(100,0)
t.penup()
t.end_fill()#框架
t.fillcolor('orange')#forestgreen
t.begin_fill()
t.goto(130,10)
t.goto(0,220)
t.goto(-130,10)
t.goto(-100,0)
t.goto(0,190)
t.goto(100,0)
t.end_fill()#烟囱
t.penup()
t.pencolor('gold')
t.goto(100,60)
t.fillcolor('gold')
t.begin_fill()
t.seth(90)
t.fd(60)
t.left(90)
t.fd(24)
t.left(90)
t.fd(26)
t.end_fill()#外部#右
t.fillcolor('grey')
t.begin_fill()
t.goto(130,10)
t.pendown()
t.fd(200)
t.goto(100,-200)
t.goto(100,0)
t.goto(130,10)
t.end_fill()#左
t.fillcolor('grey')
t.begin_fill()
t.penup()
t.goto(-100,0)
t.goto(-130,10)
t.seth(270)
t.fd(200)
t.goto(-100,-200)
t.goto(-100,0)
t.end_fill()#画圈圈
a=10b=5
t.fillcolor('grey')
for j in range(3):    
            t.begin_fill()   
            t.goto(a+100,120+b)    
            t.circle(10,360)   
            t.circle(5,360)    
            a=a+20   
            b=b+5   
 t.end_fill()
 t.fd(120)
 t.left(90)
 t.fd(40)
 t.left(90)
 t.fd(120)#左侧云
 t.pu()
t.goto(-270,100)
t.pensize(3)
t.color('skyblue')
t.pd()t.seth(0)
t.fd(170)
t.circle(20,270)
t.seth(90)
t.circle(30,130)
t.seth(90)
t.circle(50,178)
t.seth(180)
t.circle(23,180)#右侧云
t.pu()t.goto(270,150)
t.pensize(3)
t.color('skyblue')
t.pd()t.seth(180)
t.fd(170)
t.right(30)
t.circle(-20,270)
t.seth(90)
t.circle(-30,130)
t.seth(90)
t.circle(-50,178)
t.seth(0)
t.circle(-23,114)
t.goto(270,150)#画太阳
t.penup()
t.goto(150,250)
t.fillcolor('yellow')
t.begin_fill()
t.circle(20,360)
t.end_fill()#画太阳的射线
t.pencolor('yellow')
t.penup()
t.goto(170,250)
t.pendown()
d=0
for i in range(50):   
 if d % 2 == 0:       
  t.pendown()       
   t.fd(50)     
      t.goto(170,250)       
       t.left(10)    
       else:        d=d+1
       t.penup()
      
 t.fillcolor('white')
 t.begin_fill()
 t.goto(30,-30)
 t.pendown()
 t.seth(0)
 t.fd(50)
 t.right(90)
 t.fd(50)
 t.right(90)
 t.fd(50)
 t.seth(90)
 t.fd(50)t.penup()t.end_fill()#窗户的十字架t.pendown()t.pencolor('black')t.right(90)t.fd(25)t.right(90)t.fd(50)for a in range(1,3):    t.right(90)    t.fd(25)    t.right(90)    t.fd(25)    t.right(90)    t.fd(50)for b in range(1,3):    t.right(90)    t.fd(25)    t.right(90)    t.fd(50)t.left(90)t.fd(25)t.left(90)t.fd(25)t.penup()t.goto(-30,-90)t.pendown()#门t.fillcolor('grey')t.begin_fill()t.pencolor('black')t.fd(110)t.goto(-30,-90)t.seth(180)t.fd(70)t.left(90)t.fd(110)t.left(90)t.fd(70)t.end_fill()#把手t.penup()t.pencolor('black')t.goto(-40,-150)t.pendown()t.fillcolor('green')t.begin_fill()t.circle(6,360)t.end_fill()t.goto(-40,-147)t.fillcolor('yellow')t.begin_fill()t.circle(3,360)t.end_fill()t.penup()t.goto(-130,-200)t.pendown()t.right(90)#花t.goto(-120,-200)t.pendown()t.seth(270)def draw_leaf():#画花朵    for i in range(2):        t.circle(20,120)        print(t.pos())        t.left(60)        print(t.pos())t.pensize(2)t.goto(-130,-200)t.seth(90)t.fd(30)t.fillcolor('green')t.pencolor('green')t.begin_fill()draw_leaf()t.end_fill()t.pencolor('black')#t.fd(30)t.left(240)t.fillcolor('green')t.pencolor('green')t.begin_fill()draw_leaf()t.end_fill()t.pencolor('black')t.left(120)t.fd(50)t.pencolor('red')#画笔颜色t.fillcolor('yellow')#填充花朵颜色t.begin_fill()for i in range(6):#实现花朵    draw_leaf()    t.right(60)print(t.pos())t.end_fill()#第二个t.penup()t.pencolor('black')########################################################t.pensize(2)print("花干")t.goto(-150,-220)t.pendown()t.fd(20)t.fillcolor('green')t.pencolor('green')t.begin_fill()#填充叶子draw_leaf()t.end_fill()t.pencolor('black')#t.fd(30)t.left(240)t.fillcolor('green')t.pencolor('green')t.begin_fill()#填充叶子draw_leaf()t.end_fill()t.pencolor('black')t.left(120)t.fd(50)t.pencolor('red')t.fillcolor('yellow')t.begin_fill()#填充花朵for i in range(6):    draw_leaf()    t.right(60)print(t.pos())t.end_fill()#######################################################################################################################################################################门右侧花t.penup()t.seth(270)def draw_leaf():#画花朵    for i in range(2):        t.circle(20,120)        print(t.pos())        t.left(60)        print(t.pos())t.pensize(2)t.goto(-30,-200)t.seth(90)t.pendown()t.fd(30)t.fillcolor('green')t.pencolor('green')t.begin_fill()draw_leaf()t.end_fill()t.pencolor('black')#t.fd(30)t.left(240)t.fillcolor('green')t.pencolor('green')t.begin_fill()draw_leaf()t.end_fill()t.pencolor('black')t.left(120)t.fd(50)t.pencolor('red')#画笔颜色t.fillcolor('yellow')#填充花朵颜色t.begin_fill()for i in range(6):#实现花朵    draw_leaf()    t.right(60)print(t.pos())t.end_fill()##########################################第二个t.penup()t.pencolor('black')########################################################t.pensize(2)print("花干")t.goto(-70,-220)t.pendown()t.fd(20)t.fillcolor('green')t.pencolor('green')t.begin_fill()#填充叶子draw_leaf()t.end_fill()t.pencolor('black')#t.fd(30)t.left(240)t.fillcolor('green')t.pencolor('green')t.begin_fill()#填充叶子draw_leaf()t.end_fill()t.pencolor('black')t.left(120)t.fd(50)t.pencolor('red')t.fillcolor('yellow')t.begin_fill()#填充花朵for i in range(6):    draw_leaf()    t.right(60)print(t.pos())t.end_fill()#########################################################画小道t.fillcolor('gold')t.pencolor('green')t.begin_fill()t.penup()t.goto(-30,-200)t.pendown()t.goto(-70,-220)t.goto(-150,-220)t.goto(-130,-200)t.goto(-30,-200)t.end_fill()t.penup()t.pencolor('black')t.goto(-70,-220)t.pendown()t.seth(90)t.fd(20)def tree(branch,t):    if branch>5:        t.fd(branch)        t.right(20)        tree(branch-13,t)        t.left(40)        tree(branch-8,t)        t.right(20)        t.backward(branch)#t.getscreen()t.seth(0)t.left(90)t.up()t.goto(220,50)t.speed(8)t.backward(300)t.down()t.color('green')tree(80,t)t.penup()#t.getscreen().exitclick#狗t.penup()t.pensize(4)t.home()t.seth(0)# t.pd()t.goto(160,-194)t.pendown()#头部轮廓t.color('black')t.circle(10,80)#0t.circle(50,30)#1t.circle(20,60)#2t.circle(50,29.5)#3t.color('black')t.circle(10,60)#4t.circle(-80,22)#5t.circle(-15,10)#6t.circle(15,70)#7#确定鼻头位置x_nose=t.xcor()y_nose=t.ycor()t.circle(10,62)#8t.circle(50,15)#9#鼻子t.pu()t.goto(x_nose,y_nose+25)t.seth(90)t.pd()t.penup()t.goto(110,-190)t.pendown()t.begin_fill()t.circle(4)t.end_fill()#眼睛t.pu()t.goto(x_nose+30,y_nose+35)t.seth(90)t.pd()t.begin_fill()t.circle(4)t.fillcolor('white')t.begin_fill()t.pensize(2)t.circle(3)t.end_fill()t.end_fill()#耳朵t.fillcolor('yellowgreen')t.pu()t.color('#444444')t.goto(x_nose+30,y_nose+80)t.seth(182)t.pd()t.penup()t.goto(150,-160)t.pendown()t.begin_fill()t.circle(10,45)#1t.color('black')t.circle(5,15)#2t.circle(25,70)#3t.circle(5,110)#4t.rt(4)t.circle(25,70)#5t.circle(5,15)#6t.color('#444444')t.circle(5,45)#7t.end_fill()#身体t.pu()t.color('black')t.goto(x_nose+10,y_nose-10)t.seth(-130)t.pd()t.circle(75,28)#1t.circle(5,140)#2t.circle(-75,25)#3t.circle(-50,25)#4t.circle(-10,85)#5t.circle(4,145)#6t.circle(45,45)#7t.circle(125,5)#8#尾巴t.fillcolor('yellow')t.begin_fill()t.seth(0)t.circle(30,85)t.circle(20,65)t.circle(20,60)t.lt(150)t.circle(-20,90)t.circle(-25,100)t.lt(5)t.end_fill()t.pensize(4)t.goto(160,-194)#梯子t.pensize(3)t.penup()t.goto(-360,-190)t.pendown()for p in range(1,7):    t.fd(20)    t.seth(90)    t.fd(20)    t.seth(0)    t.fd(20)    t.left(90)    t.fd(20)    t.seth(0)#梯子t.speed(9)t.pensize(3)t.penup()t.goto(-350,-190)t.pendown()for p in range(1,6):    t.fd(20)    t.seth(90)    t.fd(20)    t.seth(0)    t.fd(20)    t.left(90)    t.fd(20)    t.seth(0)t.penup()t.goto(300,300)t.pendown()
t. up(1)
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值