slider.py 文件源码

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

项目:Peppy 作者: project-owner 项目源码 文件源码
def mouse_action(self, event):
        """ Mouse event handler

        :param event: event to handle
        """
        pos = event.pos

        if self.selected and not(self.last_knob_position < pos[0] < self.last_knob_position + self.knob_width and pos[1] > self.bounding_box.y) and event.type != pygame.KEYUP:
            return

        button_press_simulation = getattr(event, "p", None)

        if event.type == pygame.MOUSEBUTTONUP and self.clicked:
            self.release_action(pos)                
        elif event.type == pygame.MOUSEBUTTONDOWN and self.bounding_box.collidepoint(pos):
            self.press_action()            
        elif event.type == pygame.MOUSEMOTION and (pygame.mouse.get_pressed()[0] or button_press_simulation) and self.bounding_box.collidepoint(pos) and self.clicked:
            self.motion_action(pos)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号