Advertisement
Guest User

Untitled

a guest
Mar 8th, 2021
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.59 KB | None | 0 0
  1. from turtle import *
  2. t1 = Turtle()
  3. t2 = Turtle()
  4. t2.shape('turtle')
  5. t2.penup()
  6. t2.width(10)
  7. t2.goto(-220,0)
  8.  
  9. def labirint():
  10.     t1.color('pink')
  11.     t1.speed(0)
  12.     t1.penup()
  13.     t1.goto(-190,-200)
  14.     t1.pendown()
  15.     t1.begin_fill()
  16.     for i in range(2):
  17.         t1.forward(50)
  18.         t1.left(90)
  19.         t1.forward(400)
  20.         t1.left(90)
  21.     t1.end_fill()
  22.    
  23.    
  24.     t1.penup()
  25.     t1.goto(-70,260)
  26.     t1.pendown()
  27.     t1.begin_fill()
  28.     t1.right(90)
  29.     t1.forward(300)
  30.     t1.left(90)
  31.     t1.forward(200)
  32.     t1.left(90)
  33.     t1.forward(50)
  34.     t1.left(90)
  35.     t1.forward(150)
  36.     t1.right(90)
  37.     t1.forward(250)
  38.     t1.left(90)
  39.     t1.forward(50)
  40.     t1.end_fill()
  41.    
  42.    
  43.    
  44.     t1.penup()
  45.     t1.goto(-70,-260)
  46.     t1.begin_fill()
  47.     t1.pendown()
  48.     t1.right(90)
  49.     t1.forward(150)
  50.     t1.right(90)
  51.     t1.forward(250)
  52.     t1.right(90)
  53.     t1.forward(50)
  54.     t1.right(90)
  55.     t1.forward(200)
  56.     t1.left(90)
  57.     t1.forward(100)
  58.     t1.right(90)
  59.     t1.forward(50)
  60.     t1.end_fill()
  61.  
  62. labirint()
  63.  
  64. def stepright():
  65.     t2.penup()
  66.     t2.goto(t2.xcor()+5,t2.ycor())
  67. scr = t2.getscreen()
  68. scr.listen()
  69. scr.onkey(stepright,"Right")
  70.  
  71. def stepleft():
  72.     t2.penup()
  73.    
  74.     t2.goto(t2.xcor()-5, t2.ycor())
  75. scr = t2.getscreen()
  76. scr.listen()
  77. scr.onkey(stepleft, "Left")
  78.  
  79. def stepup():
  80.     t2.penup()
  81.     t2.goto(t2.xcor(), t2.ycor()+5)
  82. scr = t2.getscreen()
  83. scr.listen()
  84. scr.onkey(stepup, "Up")
  85.  
  86. def stepdown():
  87.     t2.penup()
  88.     t2.goto(t2.xcor(), t2.ycor()-5)
  89. scr = t2.getscreen()
  90. scr.listen()
  91. scr.onkey(stepdown, "Down")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement