def mouse_scroll(self, button):
        """Check if needs to scroll and the direction.

        button (integer in {4, 5})
            represents a mouse button pressed (in this case
            the "buttons" on the mouse wheel). More precisely
            whether the user scrolled the mouse wheel up
            (button==4) or down (button==5).
        """
        ### check if the parent of the hovered widget has
        ### an 'arrows' attribute
        try:
            arrows = self.hovered_widget.parent.arrows

        ### an attribute error may be raise though for
        ### either of those reasons (in which case you
        ### should just pass):
        ### 1) hovered widget is None and thus have
        ### no 'parent' attribute
        ### 2) the parent attribute is a command and thus
        ### never has an 'arrows' attribute
        ### 3) the paretn attribute is a menu, but doesn't
        ### have an 'arrows' attribute
        except AttributeError:
            pass

        ### otherwise, in case there really are arrows make
        ### extra checks to guarantee one of the arrows
        ### must be scrolled and which one

        else:

            ## make extra checks to guarantee one of the
            ## arrows must be scrolled; those checks are
            ## usability measures meant to make menu usage
            ## more pleasing or less confusing; they are not
            ## requirements per se;

            # if there is a hovered arrow and it is not one
            # of the retrieved arrows, cancel the scrolling
            # by returning early
            if self.hovered_arrow and self.hovered_arrow not in arrows:
                return

            # alias the parent of the hovered widget for
            # better code spacing
            hovered_parent = self.hovered_widget.parent

            # if the hovered_parent is the menu
            # manager itself, but the mouse isn't hovering
            # the pygame.Rect in its 'rect' attribute,
            # cancel the scrolling by returning early

            if hovered_parent is self:
                if not hovered_parent.rect.collidepoint(self.mouse_pos):
                    return

            # if the hovered_parent is a regular menu,
            # but the mouse isn't hovering the pygame.Rect
            # in its 'body.rect' attribute, cancel the
            # scrolling by returning early

            else:

                if not hovered_parent.body.rect.collidepoint(self.mouse_pos):
                    return

            ## finally pick and scroll the proper arrow
            ## depending on the direction of the scroll wheel
            ## used (either button 4 for scrolling the mouse
            ## wheel up or 5 for scrolling down)

            # pick the arrow
            if button == 4:
                chosen_arrow = arrows[0]
            elif button == 5:
                chosen_arrow = arrows[1]

            # call the scroll method on the chosen arrow
            # with collapse_expanded_child argument set to
            # False (for more information check the
            # 'scroll' method docstring in either the
            # menu/scroll.py or menu/submenu/scroll.py
            # module, where the collapse_expanded_child
            # parameter is explained)
            chosen_arrow.scroll(collapse_expanded_child=False)
Check if needs to scroll and the direction.

        button (integer in {4, 5})
            represents a mouse button pressed (in this case
            the "buttons" on the mouse wheel). More precisely
            whether the user scrolled the mouse wheel up
            (button==4) or down (button==5).
        
nodezator/menu/scroll.py