replace widget.parent with widget.get_parent()