本文整理汇总了Python中keyboard.Keyboard.lock方法的典型用法代码示例。如果您正苦于以下问题:Python Keyboard.lock方法的具体用法?Python Keyboard.lock怎么用?Python Keyboard.lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keyboard.Keyboard
的用法示例。
在下文中一共展示了Keyboard.lock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KeyboardHandler
# 需要导入模块: from keyboard import Keyboard [as 别名]
# 或者: from keyboard.Keyboard import lock [as 别名]
class KeyboardHandler(JsonHandler):
"""
Handle requests
"""
def prepare(self):
"""
Prepare incoming request for handler
"""
self.keyboard = Keyboard()
logger.debug("KEYBOARD - Request\n%s", self.request.body)
super(KeyboardHandler, self).prepare()
@tornado.web.asynchronous
def post(self, *args, **kwargs):
# 1 - Find operation
try:
operation = self.json_data['operation']
name = self.json_data['name']
except Exception as e:
logger.debug("KEYBOARD VIEW - Error\n%s", e)
self.write_error(500, message=e)
self.finish()
# 2 - Execute operation
method = getattr(self, operation)
result = method(name)
def lock(self, name):
"""
Lock keyboard
"""
self.keyboard.lock(name)
self.response = {}
self.write_json()
self.finish()