title: Trying to make an object jump using tkinter
body: <pre class="lang-py prettyprint-override"><code>from tkinter import *
  window = Tk()
  canvas = Canvas(window, width=1280, height=720)
  canvas.pack()
  a = (0, 50), (50, 100) # coordinates of the rectangle
  rect = canvas.create_rectangle(a, fill=&quot;red&quot;)
  #rect = canvas.create_oval(a, fill=&quot;red&quot;)
  speed = 5 # speed of the rectangle
  jump = False
      
  def keypress(event):
      x = 0
      y = 0
      if event.char == &quot;a&quot;: x-= speed
      elif event.char == &quot;d&quot;: x+= speed
      elif event.char == &quot;w&quot;: y-= speed
      elif event.char == &quot;s&quot;: y+= speed
      elif event.char == &quot; &quot;:
          y = 50
          jump = True
          while jump:
              y = 0
              jump = False
      canvas.move(rect, x, y)
      canvas.update()
      canvas.after(1)
  
  window.bind(&quot;&lt;Key&gt;&quot;, keypress)
  window.mainloop()
  </code></pre>
  <p>This is my code, im trying to make the rectangle jump but whenever i add the jump code, everything stops working even the normal &quot;asdw&quot; movement that would work otherwise</p>