0
def jump(event):
    while True:
        canvas.move("Ball", 0, -10)
        game.update()
        time.sleep(0.01)

game.bind("<space>", jump)

It just moves when I press space, but I want it to move all the time when I only click space once?

martineau
  • 119,623
  • 25
  • 170
  • 301
TP123
  • 21
  • 5
  • You can do this by scheduling periodic calls to a function — such as your `game.update()` — using the universal widget `after()` method. – martineau Jan 15 '20 at 16:08
  • @martineau Im unaware of the after() method. Can you show me the code to do this method? That would be amazing – TP123 Jan 15 '20 at 16:25
  • 2
    Here's some [documentation](https://web.archive.org/web/20190222214221id_/http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/universal.html) I found on it. There are also many answers here on SO that show how to use it. Search for "tkinter" plus "clock" or "animation". – martineau Jan 15 '20 at 16:29

0 Answers0