本文整理匯總了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