def reset_value_and_options(self, value, options, custom_command=True):
        """Reset available options and set given value.

        Parameters
        ==========
        value (Python value)
            the value must be inside the options iterable
            as well, and be of one of the allowed types
            (str, int, float, bool) or must be None.
        options (iterable of values)
            values the widget is allowed to assume. Each
            value in the options must be of type str, int
            float, bool or must be None.
        custom_command (boolean)
            indicates whether the custom command must be
            executed or not.
        """
        ### make sure options is a list
        options = list(options)

        ### check conditions that justify cancelling the
        ### operation; if any of them are confirmed, just
        ### exit the method by returning

        ## the options are the same as the current ones
        ## (and in the same order)

        if options == self.options:
            return

        ## the value and options are not valid

        try:
            self.validate_value_and_options(value, options)
        except (ValueError, TypeError) as err:

            print(err)
            return

        ### if we reach this point in the method, then we
        ### can safely replace the options and set the new
        ### value

        ## backup the current topleft position
        topleft = self.rect.topleft

        ## set the value and the options

        self.value = value
        self.options = options

        ## rebuild the widget structure
        self.build_widget_structure()

        ## restore the topleft position
        self.rect.topleft = topleft

        ### execute custom command if requested
        if custom_command:
            self.command()
Reset available options and set given value.

        Parameters
        ==========
        value (Python value)
            the value must be inside the options iterable
            as well, and be of one of the allowed types
            (str, int, float, bool) or must be None.
        options (iterable of values)
            values the widget is allowed to assume. Each
            value in the options must be of type str, int
            float, bool or must be None.
        custom_command (boolean)
            indicates whether the custom command must be
            executed or not.
        
nodezator/widget/optionmenu/op.py