parameters: (widget)
return_statement: return d
docstring: Starting at the 'widget', scans down recursively and returns a dict
      with {'name': widget_instance}, but only if the name has been set by
      the user.
      
      There is a special treatment for Radiobutton: it returns the associated
      variable instead of the widget, but only if the user has set a name to
      the variable and stored it at the widget's "var" attribute.
docstring_summary: Starting at the 'widget', scans down recursively and returns a dict
      with {'name': widget_instance}, but only if the name has been set by
      the user.
      
      There is a special treatment for Radiobutton: it returns the associated
      variable instead of the widget, but only if the user has set a name to
      the variable and stored it at the widget's "var" attribute.
docstring_tokens: Starting at the widget scans down recursively and returns a dict with { name : widget_instance } but only if the name has been set by the user . There is a special treatment for Radiobutton : it returns the associated variable instead of the widget but only if the user has set a name to the variable and stored it at the widget s var attribute .
function: def find_named_widgets(widget):
      """Starting at the 'widget', scans down recursively and returns a dict
      with {'name': widget_instance}, but only if the name has been set by
      the user.
      
      There is a special treatment for Radiobutton: it returns the associated
      variable instead of the widget, but only if the user has set a name to
      the variable and stored it at the widget's "var" attribute."""
  
      d = {}
      for name, w in widget.children.iteritems():
          # If the user has set a name for this widget, and it is a valid name.
          # Unnamed widgets get numbers in their name.
          if name[0].isalpha() or name[0] == "_":
              d[name] = w
  
          # Special case for Radiobutton
          if (
              isinstance(w, Radiobutton) and
              hasattr(w, "var") and
              not w.var._name.startswith("PY_VAR")
          ):
              d[w.var._name] = w.var
  
          # Recursive call
          d.update(find_named_widgets(w))
      return d
function_tokens: def find_named_widgets ( widget ) : d = { } for name , w in widget . children . iteritems ( ) : # If the user has set a name for this widget, and it is a valid name. # Unnamed widgets get numbers in their name. if name [ 0 ] . isalpha ( ) or name [ 0 ] == "_" : d [ name ] = w # Special case for Radiobutton if ( isinstance ( w , Radiobutton ) and hasattr ( w , "var" ) and not w . var . _name . startswith ( "PY_VAR" ) ) : d [ w . var . _name ] = w . var # Recursive call d . update ( find_named_widgets ( w ) ) return d