def validate(action, value_if_allowed, text):
    """
    This function allows only numbers to be enter in a Tk Entry.

    :param action: Type of action (1=insert, 0=delete, -1 for others)
    :type action: string
    :param value_if_allowed: value of the entry if the edit is allowed
    :type value_if_allowed: string
    :param text: the text string being inserted or deleted, if any
    :type text: string
    :return: Returns true if text entered is number else false
    :rtype: bool
    """
    if action == '1':
        if text in '0123456789':
            try:
                int(value_if_allowed)
                return True
            except ValueError:
                return False
        else:
            return False
    else:
        return True
