def _add_selectable( self, w, wdict, allow_active = False ) :
        """Internal routine to add a widget to the list of selectable ones"""

        kw = wdict.get( 'kw', None )
        # override any attempt to set this widget active
        # remember the first selectable item in a menu
        try :
            state = w.cget( 'state' )
            if state == ACTIVE :
                w.configure( state = NORMAL )
            if state != DISABLED and self._active_button is None :
                self._active_button = w
        except :
            pass

        # run any user callbacks for post-creation of widget
        w.kw = kw
        w.wdict = wdict
        if wdict.get( 'pre_pack_command', None ) is not None :
            wdict[ 'pre_pack_command' ]( w )

        # ensure we see any selection before the user supplied command
        if kw.get( 'command', None) is not None :
            self._add_binding( w, '<Return>', self._enter_key, '+' )

        self._selectables.append( w )
        self._menubuttons.append( w )
Internal routine to add a widget to the list of selectable ones
recipes/Python/442500_ExtraMenu__TkInter_menu_arbitrary_widgets/recipe-442500.py