问题
There are events called 'onkeydown' and 'onkeyup' in Javascript. Can anyone please suggest the python equivalent of it?
回答1:
Without any external library, python can't provide GUI features, such as events handling. Listening to an event such onkeydown
or onkeyup
is thus impossible with the python sdl.
If you really want to react to these events, you must use an external library providing event-driven operations, such as the Qt binding PyQt, the TKinter module, or other libraries.
来源:https://stackoverflow.com/questions/29966204/what-is-the-equivalent-for-onkeydown-and-onkeyup-javascript-events-in-python