def get_window_extent(self, renderer=None, dpi=None):
<EOL>if not self.get_visible(): return Bbox.unit()<EOL>if dpi is not None:<EOL><INDENT>dpi_orig = self.figure.dpi<EOL>self.figure.dpi = dpi<EOL><DEDENT>if self._text == '<STR_LIT>':<EOL><INDENT>tx, ty = self._get_xy_display()<EOL>return Bbox.from_bounds(tx,ty,<NUM_LIT:0>,<NUM_LIT:0>)<EOL><DEDENT>if renderer is not None:<EOL><INDENT>self._renderer = renderer<EOL><DEDENT>if self._renderer is None:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>bbox, info = self._get_layout(self._renderer)<EOL>x, y = self.get_position()<EOL>x, y = self.get_transform().transform_point((x, y))<EOL>bbox = bbox.translated(x, y)<EOL>if dpi is not None:<EOL><INDENT>self.figure.dpi = dpi_orig<EOL><DEDENT>return bbox<EOL>
Return a :class:`~matplotlib.transforms.Bbox` object bounding
the text, in display units.

In addition to being used internally, this is useful for
specifying clickable regions in a png file on a web page.

*renderer* defaults to the _renderer attribute of the text
object.  This is not assigned until the first execution of
:meth:`draw`, so you must use this kwarg if you want
to call :meth:`get_window_extent` prior to the first
:meth:`draw`.  For getting web page regions, it is
simpler to call the method after saving the figure.

*dpi* defaults to self.figure.dpi; the renderer dpi is
irrelevant.  For the web application, if figure.dpi is not
the value used when saving the figure, then the value that
was used must be specified as the *dpi* argument.