本文整理汇总了Python中pynput.keyboard.Key.esc方法的典型用法代码示例。如果您正苦于以下问题:Python Key.esc方法的具体用法?Python Key.esc怎么用?Python Key.esc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pynput.keyboard.Key
的用法示例。
在下文中一共展示了Key.esc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onKeyRelease
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def onKeyRelease(key):
global keys, charCount #Access global variables
if key == Key.esc:
writeToFile()
return False
else:
if key == Key.enter: #Write keys to file
writeToFile()
elif key == Key.space: #Write keys to file
key = ' '
writeToFile()
keys.append(key) #Store the Keys
charCount += 1 #Count keys pressed
示例2: _keyboard_on_press
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def _keyboard_on_press(self, key):
from pynput.keyboard import Key
if key == Key.esc:
self._terminate = True
return False
action = self._key_to_action(key)
if action is not None:
if action not in self._current_actions:
self._current_actions.append(action)
示例3: user_input
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def user_input(self):
if self.keys[Key.esc]:
self.running = False
return
if self.keys[KeyCode(char='t')]:
self.renderer.textures_on = not self.renderer.textures_on
self.keys[KeyCode(char='t')] = False
self.movement()
示例4: released
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def released(self, key):
if key == Key.esc:
return False
self.keys[key] = False
示例5: on_release
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def on_release(key):
global exit
if key == Key.esc:
exit += 1
if exit == 5 :
return False
示例6: on_release
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def on_release(key):
# print('{0} release'.format(key))
if key == Key.esc:
# Stop listener
return False
示例7: is_ctrl_winchrome
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_ctrl_winchrome(key):
if key == Key.ctrl:
# print(str(key).replace("Key.", "").title() +' successfully mapped to physical Alt key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Alt is now Ctrl')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Alt key.'.format(key))
return False
示例8: is_ctrl_mac
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_ctrl_mac(key):
if key == Key.ctrl:
# print(str(key).replace("Key.", "").title() +' successfully mapped to physical Alt key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Command is now Ctrl')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Command key.'.format(key))
return False
示例9: is_ctrl_terminal
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_ctrl_terminal(key):
if key == Key.ctrl:
# print(str(key).replace("Key.", "").title() +' successfully mapped to physical Ctrl key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Ctrl remains Ctrl,\nwhile in terminal apps.')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Ctrl key.'.format(key))
return False
示例10: is_alt_chromebook
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_alt_chromebook(key):
if key == Key.alt:
# print(str(key).replace("Key.", "").title() +' successfully mapped to the physical Ctrl key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Ctrl is now Alt')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Ctrl key.'.format(key))
return False
示例11: is_alt_mac
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_alt_mac(key):
if key == Key.alt:
# print(str(key).replace("Key.", "").title() +' successfully mapped to the physical Ctrl key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Alt remains Alt')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Alt key.'.format(key))
return False
示例12: is_alt_chromebook_terminal
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_alt_chromebook_terminal(key):
if key == Key.alt:
# print(str(key).replace("Key.", "").title() +' successfully mapped to the physical Search key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Search is now Alt,\nwhile in terminals apps.')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Search key.'.format(key))
return False
示例13: is_super_winmac
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_super_winmac(key):
if key == Key.cmd:
# print('Super/Win successfully mapped to the physical Search key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Ctrl key is Super/Win')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Ctrl key.'.format(key))
return False
示例14: is_super_chromebook
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_super_chromebook(key):
if key == Key.cmd:
# print('Super/Win successfully mapped to the physical Search key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Search key is Super/Win')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Search key.'.format(key))
return False
示例15: is_super_terminal
# 需要导入模块: from pynput.keyboard import Key [as 别名]
# 或者: from pynput.keyboard.Key import esc [as 别名]
def is_super_terminal(key):
if key == Key.cmd:
# print('Super/Win successfully mapped to the physical Alt key.'.format(key))
print(color.GREEN + 'Success' + color.END + ' Alt is now Super/Win,\nwhile in terminal apps.')
return False
elif key == Key.esc:
return False
else:
print('keymap failure, ' + str(key).replace("Key.", "").title() + ' may have been mapped to the physical Alt key.'.format(key))
return False