python中onkeydown和onkeyup(javascript事件)的等价物是什么? [英] What is the equivalent for onkeydown and onkeyup (javascript events) in python?

查看:354
本文介绍了python中onkeydown和onkeyup(javascript事件)的等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在javascript中有一些名为'onkeydown'和'onkeyup'的事件。任何人都可以建议python相当于它吗?

There are events called 'onkeydown' and 'onkeyup' in javascript. Can anyone please suggest the python equivalent of it?

推荐答案

没有任何外部库,python无法提供GUI功能,例如事件处理。因此,使用python sdl无法收听 onkeydown onkeyup 等事件。

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.

如果您真的想对这些事件做出反应,您必须使用提供事件驱动操作的外部库,例如 Qt 绑定 PyQt TKinter 模块或其他库。

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.

这篇关于python中onkeydown和onkeyup(javascript事件)的等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆