0

Is there a way to write a turtle onkey() statement so it will listen for any letter key, or can you only specify a single key in each onkey() statement? I don't want to have 26 onkey(), one set up for each letter "a", "b",... etc.

I want to write a simple tickertape display where every time you type a letter it adds the letter to the end of the string being written by the turtle and moves the display across by one letter.

simonc8
  • 27
  • 1
  • 1
  • 3
  • 1
    Yes, by not specifying *any* key to `onkey()`, your handler will trigger on all keys. (I.e. leave off the second argument.) However, there's glitch. When your handler fires, you won't know which key triggered it! Here's a [workaround](https://stackoverflow.com/a/59914207/5771269) to get the behavior you describe. – cdlane Jun 25 '21 at 18:52
  • Many thanks. That's really useful to know that any key will trigger onkey() if you don't specify a key. I'll investigate the workaround to determine which key was pressed. – simonc8 Jun 27 '21 at 15:03
  • Hi, you can check https://stackoverflow.com/questions/58780485/python-turtle-check-if-a-key-is-down – AABULUT Feb 09 '22 at 15:10

0 Answers0