Python pygame.MOUSEBUTTONUP Examples

The following are 30 code examples of pygame.MOUSEBUTTONUP(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygame , or try the search function .
Example #1
Source File: rigeditor.py    From renpy-shader with MIT License 8 votes vote down vote up
def handleEvents(self):
        self.mouse = self.get(MOUSE)

        for event, pos in self.context.events:
            self.mouse = pos

            handled = self.mode.handleEvent((event, pos))
            if not handled:
                if event.type == pygame.MOUSEBUTTONDOWN:
                    self.handleMouseDown(event, pos)
                elif event.type == pygame.MOUSEMOTION:
                    self.handleMouseMotion(pos)
                elif event.type == pygame.MOUSEBUTTONUP:
                    self.handleMouseUp(pos)

        if self.mouse:
            self.set(MOUSE, self.mouse) 
Example #2
Source File: Input.py    From three.py with MIT License 7 votes vote down vote up
def update(self):
        self.keyDownList = []
        self.keyUpList   = []
        self.mouseButtonDown = False
        self.mouseButtonUp   = False
        self.windowResize    = False
        for event in pygame.event.get(): # checks input events (discrete)
            if event.type == pygame.KEYDOWN:
                self.keyDownList.append( event.key )
                self.keyPressedList.append( event.key )
            elif event.type == pygame.KEYUP:
                self.keyPressedList.remove( event.key )
                self.keyUpList.append( event.key )
            elif event.type == pygame.MOUSEBUTTONDOWN:
                self.mouseButtonDown = True
                self.mouseButtonPressed = True
            elif event.type == pygame.MOUSEBUTTONUP:
                self.mouseButtonPressed = False
                self.mouseButtonUp = True
            elif event.type == pygame.QUIT:
                self.quitStatus = True
            elif event.type == pygame.VIDEORESIZE:
                self.windowResize = True
                self.windowWidth = event.w
                self.windowHeight = event.h 
Example #3
Source File: game004.py    From eduActiv8 with GNU General Public License v3.0 7 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            pos = [event.pos[0] - self.layout.game_left, event.pos[1] - self.layout.top_margin]
            found = False
            for each in self.units:
                if (each.rect.left < pos[0] < each.rect.right and each.rect.top < pos[1] < each.rect.bottom):
                    if each != self.unit_mouse_over:
                        if self.unit_mouse_over is not None:
                            self.unit_mouse_over.mouse_out()
                        self.unit_mouse_over = each
                    found = True
                    each.handle(event)
                    break
            if not found:
                if self.unit_mouse_over is not None:
                    self.unit_mouse_over.mouse_out()
                self.unit_mouse_over = None
        self.board.mainloop.redraw_needed[0] = True 
Example #4
Source File: game038.py    From eduActiv8 with GNU General Public License v3.0 6 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if event.type == pygame.MOUSEBUTTONDOWN:
            self.active_item = self.board.ships[self.board.active_ship]
            if self.active_item.unit_id < 20:
                self.current_letter_index = self.active_item.unit_id
                self.activate_letter()
            else:
                pos = [event.pos[0] - self.layout.game_left, event.pos[1] - self.layout.top_margin]
                if self.lt.rect.topleft[0] < pos[0] < self.lt.rect.topleft[0] + self.lt.rect.width and \
                                        self.lt.rect.topleft[1] < pos[1] < self.lt.rect.topleft[
                            1] + self.lt.rect.height:
                    self.next_slide(-1)
                elif self.rt.rect.topleft[0] < pos[0] < self.rt.rect.topleft[0] + self.rt.rect.width and \
                                        self.rt.rect.topleft[1] < pos[1] < self.rt.rect.topleft[
                            1] + self.rt.rect.height:
                    self.next_slide(1)
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #5
Source File: sprite.py    From pi-tracking-telescope with MIT License 6 votes vote down vote up
def handleEvent(self, event, clock):
        if not self.visible:
            self.focussed = False
            return
        
        if self.groups()[0].UI_PLACEMENT_MODE:
            if event.type == pygame.MOUSEBUTTONDOWN:
                self.pressed_time = pygame.time.get_ticks()
                self.focussed = True
                    
            if event.type == pygame.MOUSEMOTION:
                if (self.focussed and pygame.time.get_ticks() - self.pressed_time > 1000):
                    self.long_pressed = True
                    self.rect.top = event.pos[1]
                    self.rect.left = event.pos[0]
                    self.dirty = 1            
    
            if event.type == pygame.MOUSEBUTTONUP:
                if self.focussed and self.long_pressed:
                    print event.pos[1], event.pos[0]
                    
                self.pressed_time = 0
                self.long_pressed = False
                self.focussed = False 
Example #6
Source File: _utils.py    From pygame-menu with MIT License 5 votes vote down vote up
def mouse_click(x, y, inlist=True, evtype=pygame.MOUSEBUTTONUP):
        """
        Generate a mouse click event.

        :param x: X coordinate
        :type x: int, float
        :param y: Y coordinate
        :type y: int, float
        :param inlist: Return event in a list
        :type inlist: bool
        :param evtype: event type
        :type evtype: int
        :return: Event
        :rtype: :py:class:`pygame.event.Event`
        """
        event_obj = pygame.event.Event(evtype,
                                       {'pos': [float(x), float(y)],
                                        'test': True,
                                        'button': 3
                                        })
        if inlist:
            event_obj = [event_obj]
        return event_obj 
Example #7
Source File: panel.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def gainFocus(self, _event):
        return _event.type == pygame.MOUSEBUTTONUP and self.getcoordinatesatpixel(_event.pos[0]-self.corner[0]. _event.pos[1]-self.corner[1]) != (None, None) 
Example #8
Source File: selector.py    From pygame-menu with MIT License 5 votes vote down vote up
def update(self, events):
        updated = False
        for event in events:  # type: pygame.event.Event

            if event.type == pygame.KEYDOWN:  # Check key is valid
                if not check_key_pressed_valid(event):
                    continue

            # Events
            keydown = event.type == pygame.KEYDOWN
            joy_hatmotion = self.joystick_enabled and event.type == pygame.JOYHATMOTION
            joy_axismotion = self.joystick_enabled and event.type == pygame.JOYAXISMOTION
            joy_button_down = self.joystick_enabled and event.type == pygame.JOYBUTTONDOWN

            if keydown and event.key == _controls.KEY_LEFT or \
                    joy_hatmotion and event.value == _controls.JOY_LEFT or \
                    joy_axismotion and event.axis == _controls.JOY_AXIS_X and event.value < _controls.JOY_DEADZONE:
                self.sound.play_key_add()
                self.left()
                updated = True

            elif keydown and event.key == _controls.KEY_RIGHT or \
                    joy_hatmotion and event.value == _controls.JOY_RIGHT or \
                    joy_axismotion and event.axis == _controls.JOY_AXIS_X and event.value > -_controls.JOY_DEADZONE:
                self.sound.play_key_add()
                self.right()
                updated = True

            elif keydown and event.key == _controls.KEY_APPLY or \
                    joy_button_down and event.button == _controls.JOY_BUTTON_SELECT:
                self.sound.play_open_menu()
                self.apply(*self._elements[self._index][1:])
                updated = True

            elif self.mouse_enabled and event.type == pygame.MOUSEBUTTONUP:
                if self._rect.collidepoint(*event.pos):
                    # Check if mouse collides left or right as percentage, use only X coordinate
                    mousex, _ = event.pos
                    topleft, _ = self._rect.topleft
                    topright, _ = self._rect.topright
                    dist = mousex - (topleft + self._title_size)  # Distance from label
                    if dist > 0:  # User clicked the options, not label

                        # Position in percentage, if <0.5 user clicked left
                        pos = dist / float(topright - topleft - self._title_size)
                        if pos <= 0.5:
                            self.left()
                        else:
                            self.right()
                        updated = True

        return updated 
Example #9
Source File: menubar.py    From pygame-menu with MIT License 5 votes vote down vote up
def update(self, events):
        updated = False
        for event in events:  # type: pygame.event.Event

            if self.mouse_enabled and event.type == pygame.MOUSEBUTTONUP:
                if self._backbox_rect and self._backbox_rect.collidepoint(*event.pos):
                    self.sound.play_click_mouse()
                    self.apply()
                    updated = True

            elif self.joystick_enabled and event.type == pygame.JOYBUTTONDOWN:
                if event.button == _controls.JOY_BUTTON_BACK:
                    self.sound.play_key_del()
                    self.apply()
                    updated = True

        return updated 
Example #10
Source File: button.py    From pygame-menu with MIT License 5 votes vote down vote up
def update(self, events):
        updated = False
        for event in events:  # type: pygame.event.Event

            if event.type == pygame.KEYDOWN and event.key == _controls.KEY_APPLY or \
                    self.joystick_enabled and event.type == pygame.JOYBUTTONDOWN and event.button == _controls.JOY_BUTTON_SELECT:
                self.sound.play_open_menu()
                self.apply()
                updated = True

            elif self.mouse_enabled and event.type == pygame.MOUSEBUTTONUP:
                self.sound.play_click_mouse()
                if self._rect.collidepoint(*event.pos):
                    self.apply()
                    updated = True

        return updated 
Example #11
Source File: gui.py    From openag_brain_box with GNU General Public License v3.0 5 votes vote down vote up
def handleEvents(self):
        for event in pygame.event.get():
            if event.type == pygame.QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE) :
                self.webcam.stop()
                pygame.quit()
                sys.exit()
            elif event.type == pygame.MOUSEBUTTONUP:
                x,y = pygame.mouse.get_pos()
                logger.info('{}, {}'.format(x,y))
                if 320<x<800:
                    if self.canny:
                        self.canny = False
                    else:
                        self.canny = True 
Example #12
Source File: loginscreen.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        if self.enabled:
            if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
                if self.fcode == 2:  # shift
                    self.ls.keyboard.shift_it()
                    self.activate_color()
                elif self.ls.in_focus is not None:
                    lhv = len(self.ls.in_focus.value)
                    if isinstance(self.ls.in_focus, PEdit):
                        if self.fcode == 0: # key
                            char = ex.unival(self.get_value())
                            if len(char) > 0 and lhv < 21:
                                if self.ls.lang.ltr_text:
                                    self.ls.in_focus.value = ex.unival(self.ls.in_focus.value) + char
                                else:
                                    self.ls.in_focus.value = char + ex.unival(self.ls.in_focus.value)
                        if self.fcode == 1:  # backspace
                            if lhv > 0:
                                if self.ls.lang.ltr_text:
                                    self.ls.in_focus.value = self.ls.in_focus.value[0:lhv - 1]
                                else:
                                    self.ls.in_focus.value = self.ls.in_focus.value[1:lhv]

                        if self.ls.in_focus.selection_modifier:
                            if self.ls.prev_user_checked:
                                if self.ls.in_focus.value != self.ls.prev_user_checked.value:
                                    self.ls.prev_user_checked.update_me = True
                                    self.ls.prev_user_checked.checked = False
                            if self.ls.username_count > 5:
                                self.ls.reload_selects()
                            self.ls.set_scrollbar_top(self.ls.scroll_min_top)
                        self.ls.in_focus.update_trigger()
            elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
                pass 
Example #13
Source File: loginscreen.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        if self.visible:
            if event.type == pygame.MOUSEMOTION:
                self.onMouseMotion(event)
            elif event.type == pygame.MOUSEBUTTONDOWN:
                self.onMouseButtonDown()
            elif event.type == pygame.MOUSEBUTTONUP:
                self.onMouseButtonUp()
            elif event.type == pygame.KEYDOWN:
                self.onKeyDown(event) 
Example #14
Source File: loginscreen.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        if event.type == pygame.MOUSEMOTION:
            self.onMouseEnter()
        elif event.type == pygame.MOUSEBUTTONDOWN:
            self.onMouseButtonDown(event)
        elif event.type == pygame.MOUSEBUTTONUP:
            self.onMouseButtonUp()
        elif event.type == pygame.KEYDOWN:
            self.onKeyDown(event) 
Example #15
Source File: loginscreen.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        if self.visible:
            if event.type == pygame.MOUSEMOTION:
                self.onMouseEnter()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                self.onMouseButtonDown()
            elif event.type == pygame.MOUSEBUTTONUP:
                self.onMouseButtonUp()
            elif event.type == pygame.KEYDOWN:
                self.onKeyDown(event) 
Example #16
Source File: loginscreen.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        if self.visible:
            if event.type == pygame.MOUSEMOTION:
                self.onMouseEnter()
            if event.type == pygame.MOUSEBUTTONDOWN:
                self.onMouseButtonDown()
            if event.type == pygame.MOUSEBUTTONUP:
                self.onMouseButtonUp()
            if event.type == pygame.KEYDOWN:
                self.onKeyDown(event) 
Example #17
Source File: panel.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def keepFocus(self, _event):
        return _event.type != pygame.MOUSEBUTTONUP or self.getcoordinatesatpixel(_event.pos[0]-self.corner[0]. _event.pos[1]-self.corner[1]) != (None, None) 
Example #18
Source File: game025.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)  # send event handling up
        if event.type == pygame.MOUSEBUTTONUP:
            for each in self.board.units:
                if each.is_door is True:
                    self.board.all_sprites_list.move_to_front(each)
            self.check_result()
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #19
Source File: game084.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if not self.show_msg:
            if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER):
                lhv = len(self.home_square.value)
                self.changed_since_check = True
                if event.key == pygame.K_BACKSPACE:
                    if lhv > 0:
                        self.home_square.value = self.home_square.value[0:lhv - 1]
                elif not self.board.grid[4][18]:
                    char = event.unicode
                    if len(char) > 0 and lhv < 2 and char in self.digits:
                        self.home_square.value += char
                self.home_square.update_me = True
                self.mainloop.redraw_needed[0] = True
            elif event.type == pygame.MOUSEMOTION and self.drag:
                if self.board.grid[4][18]:
                    self.home_square.value = ""
                    self.home_square.update_me = True
            elif event.type == pygame.MOUSEBUTTONUP:
                for each in self.board.units:
                    if each.is_door is True:
                        self.board.all_sprites_list.move_to_front(each)
                if self.board.grid[4][18]:
                    self.check_result()
            elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER):
                self.check_result()
            if event.type == pygame.MOUSEBUTTONDOWN:
                self.auto_check_reset()
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #20
Source File: game034.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if not self.show_msg:
            if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER):
                lhv = len(self.home_square.value)
                self.changed_since_check = True
                if event.key == pygame.K_BACKSPACE:
                    if lhv > 0:
                        self.home_square.value = self.home_square.value[0:lhv - 1]
                elif not self.board.grid[4][16]:
                    char = event.unicode
                    if len(char) > 0 and char in self.digits:
                        self.home_square.value = char
                self.home_square.update_me = True
                self.mainloop.redraw_needed[0] = True
            elif event.type == pygame.MOUSEMOTION and self.drag:
                if self.board.grid[4][16]:
                    self.home_square.value = ""
                    self.home_square.update_me = True
            elif event.type == pygame.MOUSEBUTTONUP:
                for each in self.board.units:
                    if each.is_door is True:
                        self.board.all_sprites_list.move_to_front(each)
                if self.board.grid[4][16]:
                    self.home_square.value = ""
                    self.home_square.update_me = True
                    self.check_result()
            elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER):
                self.check_result()
            if event.type == pygame.MOUSEBUTTONDOWN:
                self.auto_check_reset()
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #21
Source File: game027.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)  # send event handling up
        if event.type == pygame.MOUSEBUTTONUP:
            for each in self.board.units:
                if each.is_door is True:
                    self.board.all_sprites_list.move_to_front(each)

        elif event.type == pygame.MOUSEBUTTONDOWN:
            self.auto_check_reset()

        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #22
Source File: game015.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)  # send event handling up
        if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
            self.auto_check_reset()
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #23
Source File: game047.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if event.type == pygame.MOUSEBUTTONUP:
            for each in self.board.units:
                if each.is_door is True:
                    self.board.all_sprites_list.move_to_front(each)
                self.auto_check()
            self.check_result()

        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #24
Source File: game035.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if not self.show_msg:
            if event.type == pygame.KEYDOWN and (event.key != pygame.K_RETURN and event.key != pygame.K_KP_ENTER):
                lhv = len(self.home_square.value)
                self.changed_since_check = True
                if event.key == pygame.K_BACKSPACE:
                    if lhv > 0:
                        self.home_square.value = self.home_square.value[0:lhv - 1]
                elif not self.board.grid[4][18]:
                    char = event.unicode
                    if len(char) > 0 and char in self.digits:
                        self.home_square.value = char
                self.home_square.update_me = True
                self.mainloop.redraw_needed[0] = True
            elif event.type == pygame.MOUSEMOTION and self.drag:
                if self.board.grid[4][18]:
                    self.home_square.value = ""
                    self.home_square.update_me = True
            elif event.type == pygame.MOUSEBUTTONUP:
                for each in self.board.units:
                    if each.is_door is True:
                        self.board.all_sprites_list.move_to_front(each)
                if self.board.grid[4][18]:
                    self.check_result()
                    self.home_square.value = ""
                    self.home_square.update_me = True
            elif event.type == pygame.KEYDOWN and (event.key == pygame.K_RETURN or event.key == pygame.K_KP_ENTER):
                self.check_result()
            if event.type == pygame.MOUSEBUTTONDOWN:
                self.auto_check_reset()
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #25
Source File: game012.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)  # send event handling up
        if self.ship_id < 0 and event.type == pygame.MOUSEBUTTONDOWN:
            # make it impossible to deselect the main character
            self.board.active_ship = 0
            self.ship_id = 0
            if self.moveable:
                pos = event.pos
                column = pos[0] // (self.layout.width)
                row = (pos[1] - self.layout.top_margin) // (self.layout.height)
                self.direction = [0, 0]
                arrow_clicked = False
                if column == self.owl_pos[0] - 1 and row == self.owl_pos[1]:
                    self.direction[0] = -1
                    arrow_clicked = True
                elif column == self.owl_pos[0] + 1 and row == self.owl_pos[1]:
                    self.direction[0] = 1
                    arrow_clicked = True
                elif column == self.owl_pos[0] and row == self.owl_pos[1] - 1:
                    self.direction[1] = -1
                    arrow_clicked = True
                elif column == self.owl_pos[0] and row == self.owl_pos[1] + 1:
                    self.direction[1] = 1
                    arrow_clicked = True

                if arrow_clicked:
                    self.check_direction_kdown()
        if (event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN) and not self.moveable:
            self.move = False
        elif event.type == pygame.KEYUP or event.type == pygame.MOUSEBUTTONUP:
            self.highlight_color(-1)
            self.mainloop.redraw_needed[0] = True
            self.move = False 
Example #26
Source File: game050.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
            self.auto_check_reset()
        elif event.type == pygame.MOUSEBUTTONUP and event.button == 1:
            self.draw_lines()
            self.mainloop.redraw_needed[0] = True
            self.check_result()

        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #27
Source File: game056.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)  # send event handling up
        if event.type == pygame.MOUSEBUTTONUP:
            for each in self.board.units:
                if each.is_door is True:
                    self.board.all_sprites_list.move_to_front(each)

        if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN:
            self.auto_check_reset()
        elif event.type == pygame.KEYUP or event.type == pygame.MOUSEBUTTONUP:
            self.check_result() 
Example #28
Source File: game046.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        gd.BoardGame.handle(self, event)
        if event.type == pygame.MOUSEMOTION or event.type == pygame.MOUSEBUTTONUP:
            self.default_hover(event) 
Example #29
Source File: booth.py    From pibooth with MIT License 5 votes vote down vote up
def find_capture_event(self, events):
        """Return the first found event if found in the list.
        """
        for event in events:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_p:
                return event
            if event.type == pygame.MOUSEBUTTONUP and event.button in (1, 2, 3):
                # Don't consider the mouse wheel (button 4 & 5):
                rect = self._window.get_rect()
                if pygame.Rect(0, 0, rect.width // 2, rect.height).collidepoint(event.pos):
                    return event
            if event.type == BUTTONDOWN and event.capture:
                return event
        return None 
Example #30
Source File: menu_items.py    From eduActiv8 with GNU General Public License v3.0 5 votes vote down vote up
def handle(self, event):
        if event.type == pygame.MOUSEMOTION:
            if not self.hover:
                self.board.mainloop.redraw_needed[1] = True
                self.hover = True
                self.update_me = True
                self.update()
        elif event.type == pygame.MOUSEBUTTONUP:
            self.mouse_click()