当前位置: 首页>>代码示例>>Python>>正文


Python Keyboard.lock方法代码示例

本文整理汇总了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()
开发者ID:thor27,项目名称:window-manager,代码行数:38,代码来源:views.py


注:本文中的keyboard.Keyboard.lock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。