pygame_console.py 文件源码

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

项目:pyrepl 作者: dajose 项目源码 文件源码
def get_event(self, block=1):
        """Return an Event instance.  Returns None if |block| is false
        and there is no event pending, otherwise waits for the
        completion of an event."""
        while 1:
            if self.event_queue:
                return self.event_queue.pop(0)
            elif block:
                pyg_event = pygame.event.wait()
            else:
                pyg_event = pygame.event.poll()
                if pyg_event.type == NOEVENT:
                    return

            if pyg_event.key in modcolors:
                continue

            k, c = self.tr_event(pyg_event)
            self.cmd_buf += c.encode('ascii', 'replace')
            self.k = k

            if not isinstance(k, types.DictType):
                e = Event(k, self.cmd_buf, [])
                self.k = self.keymap
                self.cmd_buf = ''
                return e
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号