title: Python Turtle hold key function
body: <p>I am attempting to make pong using Turtle, I have most things working, however, I would like to implement the ability to hold a key to move the bumpers up and down, rather than having to tap the key multiple times. These are my functions for movement so far.</p>
  
  <pre><code>def lbump_move_up():
      x = lbump.ycor()
      x += bumpspeed
      if x &gt; 240:
          x = 240
      lbump.sety(x)
  
  def lbump_move_down():
      x = lbump.ycor()
      x -= bumpspeed
      if x &lt; -240:
          x = -240
      lbump.sety(x)
  
  def rbump_move_up():
      x = rbump.ycor()
      x += bumpspeed
      if x &gt; 240:
          x = 240
      rbump.sety(x)
  
  def rbump_move_down():
      x = rbump.ycor()
      x -= bumpspeed
      if x &lt; -240:
          x = -240
      rbump.sety(x)
  
  turtle.listen()
  turtle.onkey(lbump_move_up,'w')
  turtle.onkey(rbump_move_up,'Up')
  turtle.onkey(lbump_move_down,'s')
  turtle.onkey(rbump_move_down,'Down')
  turtle.onkey(ball_move,'Return')
  </code></pre>