本文整理汇总了Python中pygaze.keyboard.Keyboard.set_keylist方法的典型用法代码示例。如果您正苦于以下问题:Python Keyboard.set_keylist方法的具体用法?Python Keyboard.set_keylist怎么用?Python Keyboard.set_keylist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygaze.keyboard.Keyboard
的用法示例。
在下文中一共展示了Keyboard.set_keylist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from pygaze.keyboard import Keyboard [as 别名]
# 或者: from pygaze.keyboard.Keyboard import set_keylist [as 别名]
# # # # #
# test Keyboard
# test set_keylist, set_timeout and get_key
scr.clear()
scr.draw_text("The keylist has been set to ['1','5','e','s','left','space']; \
please confirm that you can press these keys and not any other key. Note that \
if you press Space, the test will advance to the next phase! \
\n\n\nThis tests: \
\n- Keyboard.set_keylist \
\n- Keyboard.get_key \
\n- Keyboatd.set_timeout")
disp.fill(scr)
t1 = disp.show()
log.write(["Keyboard", t1])
kb.set_keylist(keylist=['1','5','e','s','left','space'])
kb.set_timeout(timeout=0.1)
key, presstime = kb.get_key()
kb.set_timeout(timeout=None)
while not key == 'space':
# get new key
key, presstime = kb.get_key()
# draw the key name
scr.clear()
scr.draw_text("keylist = ['1','5','e','s','left','space']\n\nYou pressed:\n\n%s" % key)
disp.fill(scr)
disp.show()
kb.set_keylist(keylist=['space'])
# # # # #