def integerbox(msg="", title=" ", default="",
               lowerbound=0, upperbound=99, image=None, root=None):
    """
    Show a box in which a user can enter an integer.

    In addition to arguments for msg and title, this function accepts
    integer arguments for "default", "lowerbound", and "upperbound".

    The default argument may be None.

    When the user enters some text, the text is checked to verify that it
    can be converted to an integer between the lowerbound and upperbound.

    If it can be, the integer (not the text) is returned.

    If it cannot, then an error msg is displayed, and the integerbox is
    redisplayed.

    If the user cancels the operation, None is returned.

    :param str msg: the msg to be displayed
    :param str title: the window title
    :param str default: The default value to return
    :param int lowerbound: The lower-most value allowed
    :param int upperbound: The upper-most value allowed
    :param str image: Filename of image to display
    :param tk_widget root: Top-level Tk widget
    :return: the integer value entered by the user

    """

    if not msg:
        msg = "Enter an integer between {0} and {1}".format(
            lowerbound, upperbound)

    # Validate the arguments for default, lowerbound and upperbound and
    # convert to integers
    exception_string = (
        'integerbox "{0}" must be an integer.  It is >{1}< of type {2}')
    if default:
        try:
            default = int(default)
        except ValueError:
            raise ValueError(
                exception_string.format('default', default, type(default)))
    try:
        lowerbound = int(lowerbound)
    except ValueError:
        raise ValueError(
            exception_string.format('lowerbound',
                                    lowerbound, type(lowerbound)))
    try:
        upperbound = int(upperbound)
    except ValueError:
        raise ValueError(
            exception_string.format('upperbound',
                                    upperbound, type(upperbound)))

    while True:
        reply = enterbox(msg, title, str(default), image=image, root=root)
        if reply is None:
            return None
        try:
            reply = int(reply)
        except:
            msgbox('The value that you entered:\n\t"{}"\nis not an integer.'
                   .format(reply), "Error")
            continue
        if lowerbound < reply:
            msgbox('The value that you entered is less than the lower '
                   'bound of {}.'.format(lowerbound), "Error")
            continue
        if reply > upperbound:
            msgbox('The value that you entered is greater than the upper bound'
                   ' of {}.'.format(
                       upperbound), "Error")
            continue
        # reply has passed all validation checks.
        # It is an integer between the specified bounds.
        return reply


# -------------------------------------------------------------------
# multenterbox
# -------------------------------------------------------------------
# TODO RL: Should defaults be list constructors.
# i think after multiple calls, the value is retained.
# TODO RL: Rename/alias to multienterbox?
# default should be None and then in the logic create an empty list.
dataset/ETHPy150Open datalyze-solutions/pandas-qt/pandasqt/ui/fallback/easygui/boxes/derived_boxes.py/integerbox/swapped operands of `<`