python 和 symbian - 击键捕获
我正在尝试用 python 编写一个简单的原型应用程序来捕获用户的击键,同时编写短信(SMS)来收集一些统计信息,以便在基于 Symbian 的手机的生物识别应用程序中使用。 我以前从未使用过python,接触的也很少。 但是,我确实遇到了一个示例 http://wiki.forum.nokia.com/ index.php/How_to_use_Keys_in_PyS60 详细介绍了如何轻松捕获 UP、DOWN、LEFT、RIGHT 和 0-9。 我尝试在 pys60 API 中查找有关 key_codes 和 keypress 的信息,但几乎没有可用的信息,因为我正在寻找如何捕获“a”、“b”等字符的示例(假设预测文本已禁用)。 另外,如果无法捕获字符,那么将按键映射到字符的可行性如何? 即 228 = 'b','t'?
谁能给我提供一些例子、建议或推动正确的方向?
I'm trying to write a simple prototyping appliaction in python to capture a users keystrokes while writing a text messages (SMS) to collect some stat info for use in a biometric application for Symbian based phones. I have never used python before and have had very little exposure to it. However, I did come across an example http://wiki.forum.nokia.com/index.php/How_to_use_Keys_in_PyS60 detailing how to capture UP, DOWN, LEFT, RIGHT, and 0-9 easily enough. I tried to find information on key_codes and keypress in the pys60 API but little is available as I'm looking for an example of how to capture characters such as 'a', 'b' etc. assuming that predictive text is disabled. Also, if it is not possible to capture characters, how feasible is it to map keypresses to characters? i.e. 228 = 'b','t'?
Can anyone provide me with some examples, suggestions or a push in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您在这里寻找错误的东西。
正如您已经说过的,按键代码和按键事件只会捕获向上、向下等(实际按钮)。 用户可以通过多种方式输入字母,这都是通过软件完成的(例如 22 是“b”,或者 228 可能是“cat”或“bat”),并且无法仅根据用户输入的内容来判断他们按下的按钮。 大多数手机还内置自动完成功能,这将添加用户未按下按钮的字符。
尝试寻找捕获用户所看到的实际文本的方法。
I think you are searching for the wrong thing here.
Key codes and keypress events will only capture up, down, etc. (actual buttons), as you already stated. The user can enter letters in multiple ways, which is all done through software (e.g. 22 is a 'b', or 228 might be 'cat' or 'bat') and there is no way to tell what the user entered based just on the buttons they hit. There is also auto-completion built into most phones, which will add characters the user did not press buttons for.
Try searching for ways of capturing the actual text the user is seeing.