Is there an event listener when using graphics.py (Zelle) and Python?
With turtle
graphics there is: onkeypress
.
With pygame
there is: if event.key == pygame.K_w:
.
I am hoping to find something that will work in a similar manner using graphics.py
.
As I said in a comment you can use
setMouseHandler()
to listen for mouse-clicks, but there really isn't something existing for key-presses — however you can kind of fake it by callingcheckMouse()
in a loop (which might eliminate the need to hackgraphics.py
). From what you said in a recent comment, I see you may have discovered this by yourself...Anyhow, for what it's worth, here a simple demo illustrating what I meant: