Advanced Python Keyboard Events?
Use a keyup and keydown handler with a global array:
keys = []def down(event): global keys if not event.keycode in keys: keys.append(event.keycode)def up(event): global keys keys.remove(event.keycode)root.bind('<KeyPress>', down)root.bind('<KeyRelease>', up)
Now you can check for multiple entries in keys
. To remove that continuous behavior you described, you have to compare the previous state of keys
after an event happens.