requesthandler.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Peppy 作者: project-owner 项目源码 文件源码
def handle_command(self, d):
        """ Handles commands sent from web client 

        :param d: command object
        """

        if d["command"] == "init":
            json_data = self.screen_to_json()
            web_socket.send_message(json_data)
        elif d["command"] == "mouse":
            a = {}
            a["pos"] = (d["x"], d["y"])
            a["button"] = d["b"]
            event = None
            if d["d"] == 0:
                event = pygame.event.Event(pygame.MOUSEBUTTONDOWN, **a)
            elif d["d"] == 1:
                event = pygame.event.Event(pygame.MOUSEBUTTONUP, **a)
            elif d["d"] == 2:
                event = pygame.event.Event(pygame.MOUSEMOTION, **a)
                event.p = True
            event.source = "browser"
            thread = Thread(target=pygame.event.post, args=[event])
            thread.start()
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号