'电报'作为数据输入的一种手段 [英] 'telegraphy' as a means of data entry

查看:102
本文介绍了'电报'作为数据输入的一种手段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要按照计算机键盘上特定键的按键/释放次序记录事件的相应时间。

问题中的关键也应该在沮丧时发​​出声音(也许是一个孤独的叹息 - / b
嘻嘻)。从表面上看,使用来自Tkinter的合适组合,时间和

winsound来实现这一目标似乎应该相当简单。如果有人已经这样做了,如果他们愿意与我分享结果,我将不胜感激。如果没有,我会欢迎建议

如何进行。谢谢。


和平

I need to record the respective times of the events in a sequence of
presses/releases of a particular key on the computer keyboard. The key in
question should also make a sound when depressed (perhaps a forlorn sigh - tee
hee). On the face of it, it seems like it should be fairly straightforward to
achieve this with a suitable combination of ingredients from Tkinter, time and
winsound. If someone has already done it, I would be grateful if they were
willing to share the results with me. If not, I would welcome suggestions as to
how to proceed. Thanks.

Peace

推荐答案

Elaine Jackson写道:
Elaine Jackson wrote:
我需要在计算机键盘上按键/释放特定键的顺序记录事件的相应时间。问题中的关键还应该在沮丧时发​​出声音(也许是一种孤独的叹息 - 嘻嘻)。从表面上看,使用Tkinter的合适成分,时间和
winsound来实现这一目标似乎相当简单。
I need to record the respective times of the events in a sequence of
presses/releases of a particular key on the computer keyboard. The key in
question should also make a sound when depressed (perhaps a forlorn sigh - tee
hee). On the face of it, it seems like it should be fairly straightforward to
achieve this with a suitable combination of ingredients from Tkinter, time and
winsound.




这是否必须工作无论计算机上发生了什么?

计算机,或者如果仅在窗口

的情况下才能正常工作申请是否有效? (换句话说,

如果按键只发送到这个程序那么很容易做到,

但是如果你想在任何时候捕获*所有*按键,

你不能这样做,AFAIK,只使用像wxPython这样的GUI工具包

或Tkinter ......你必须使用某种类型的操作系统挂钩。 )


-Peter



Does this have to work regardless of what else is going on on
the computer, or is it okay if it works only when the window
for this particular application is active? (In other words,
it''s easy to do if the keypresses go only to this program,
but if you want to capture *all* keypresses at all times,
you can''t do it, AFAIK, using just a GUI toolkit like wxPython
or Tkinter... you have to use an OS hook of some kind.)

-Peter




" Peter Hansen" < PE *** @ engcorp.com>在留言中写道

news:8Y ******************** @ powergate.ca ...

| Elaine Jackson写道:

|

| >我需要按照

|的顺序记录事件的相应时间>按下/释放计算机键盘上的特定键。关键在

| >问题也应该在沮丧时发​​出声音(也许是一种孤独的叹息 -

tee

|> hee)。从表面上看,它似乎应该相当简单

to

| >用适当的Tkinter成分组合来实现这一目标,时间



| > winsound。

|

|无论发生什么事情,这都必须工作

|电脑,或者只有在窗口工作时才可以使用

|这个特定的应用程序是活跃的? (换句话说,

|如果按键只发送到这个节目,这很容易做到,

|但是如果你想捕获*所有*按键所有的时间,

|你不能这样做,AFAIK,只使用像wxPython这样的GUI工具包

|或者Tkinter ......你必须使用OS钩子某种。)

|

| -Peter


当窗口处于活动状态时。

"Peter Hansen" <pe***@engcorp.com> wrote in message
news:8Y********************@powergate.ca...
| Elaine Jackson wrote:
|
| > I need to record the respective times of the events in a sequence of
| > presses/releases of a particular key on the computer keyboard. The key in
| > question should also make a sound when depressed (perhaps a forlorn sigh -
tee
| > hee). On the face of it, it seems like it should be fairly straightforward
to
| > achieve this with a suitable combination of ingredients from Tkinter, time
and
| > winsound.
|
| Does this have to work regardless of what else is going on on
| the computer, or is it okay if it works only when the window
| for this particular application is active? (In other words,
| it''s easy to do if the keypresses go only to this program,
| but if you want to capture *all* keypresses at all times,
| you can''t do it, AFAIK, using just a GUI toolkit like wxPython
| or Tkinter... you have to use an OS hook of some kind.)
|
| -Peter

Just when the window is active.


Elaine Jackson写道:
Elaine Jackson wrote:
彼得汉森 < PE *** @ engcorp.com>写道:
| Elaine Jackson写道:
|
| >我需要按照
|的顺序记录事件的相应时间>按下/释放计算机键盘上的特定键。
|
|无论
|还有什么,这都必须有效电脑,或者只有在窗口工作时才可以。
|对于这个特定的应用程序是否活跃?

当窗口处于活动状态时。
"Peter Hansen" <pe***@engcorp.com> wrote:
| Elaine Jackson wrote:
|
| > I need to record the respective times of the events in a sequence of
| > presses/releases of a particular key on the computer keyboard.
|
| Does this have to work regardless of what else is going on on
| the computer, or is it okay if it works only when the window
| for this particular application is active?

Just when the window is active.




然后wxPython中的相关位将涉及这些行

行,从我正在处理的一个小应用程序中删除:


class Frame(wx.Frame):

def __init __(self,title):

wx.Frame .__ init __(self,None,-1,title)

p = wx.Panel(self,-1)


self.Bind(wx.EVT_KEY_DOWN,self.OnKeyDown)

#self.Bind(wx.EVT_KEY_DOWN,self.OnKeyUp)

def OnKeyDown(self,evt):

如果evt.GetKeyCode()== wx.WXK_DELETE:

#whatever

你会的能够使用time.time()或time.clock()来记录按键的次数

,而且我一般不会使用

音频所以我不知道什么是最好的。


替代方案是Pygame, http://www.pygame.org/ ,其中
当然可以处理关键的东西和音频。


而且Tkinter当然可以做到,但我不做Tkinter。 :)


-Peter



Then the relevant bits in wxPython would involve lines like these
lines, pruned from a little app I''ve been working on:

class Frame(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, -1, title)
p = wx.Panel(self, -1)

self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
# self.Bind(wx.EVT_KEY_DOWN, self.OnKeyUp)
def OnKeyDown(self, evt):
if evt.GetKeyCode() == wx.WXK_DELETE:
# whatever
You would be able to use time.time() or time.clock() to record
the times of the keypresses, and I don''t generally work with
audio so I don''t know what would be best.

An alternative would be Pygame, http://www.pygame.org/, which
certainly could handle both the key stuff and the audio.

And Tkinter could certainly do it to, but I don''t do Tkinter. :)

-Peter


这篇关于'电报'作为数据输入的一种手段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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