def _attach_child(self, child):
if not isinstance(child, Widget):<EOL><INDENT>raise UsageError(f"<STR_LIT>")<EOL><DEDENT>if child.parent is self:<EOL><INDENT>return child<EOL><DEDENT>if child.parent is not None:<EOL><INDENT>raise UsageError(f"<STR_LIT>")<EOL><DEDENT>child.__parent = self<EOL>self.__children.add(child)<EOL>if self.is_attached_to_gui:<EOL><INDENT>for widget in child.__yield_self_and_all_children():<EOL><INDENT>widget.__root = self.root<EOL>widget.do_attach()<EOL>widget.dispatch_event('<STR_LIT>', widget)<EOL><DEDENT><DEDENT>if self.is_hidden:<EOL><INDENT>self._hide_children()<EOL><DEDENT>else:<EOL><INDENT>self._unhide_children(False)<EOL><DEDENT>self.dispatch_event('<STR_LIT>', self, child)<EOL>return child<EOL>
Add a child to this widget.

This method checks to make sure the child isn't already attached to 
some other widget, tells the child who it's new parent is, and adds the 
child to an internal list of children widgets.

This method is only meant to be called in subclasses of Widget, which 
is why it's prefixed with an underscore.  For example, you would use 
this method if implementing a