(self, ax, *, horizOn=True, vertOn=True, useblit=False,
**lineprops)
| 2073 | See :doc:`/gallery/widgets/cursor`. |
| 2074 | """ |
| 2075 | def __init__(self, ax, *, horizOn=True, vertOn=True, useblit=False, |
| 2076 | **lineprops): |
| 2077 | super().__init__(ax) |
| 2078 | |
| 2079 | self.connect_event('motion_notify_event', self.onmove) |
| 2080 | self.connect_event('draw_event', self.clear) |
| 2081 | |
| 2082 | self.visible = True |
| 2083 | self.horizOn = horizOn |
| 2084 | self.vertOn = vertOn |
| 2085 | self.useblit = useblit and self.canvas.supports_blit # TODO: make dynamic |
| 2086 | |
| 2087 | if self.useblit: |
| 2088 | for ax_ in ax.get_figure(root=True).get_axes(): |
| 2089 | if ax_ is not ax and ax.bbox.overlaps(ax_.bbox): |
| 2090 | _api.warn_external( |
| 2091 | "Cursor blitting is currently not supported on " |
| 2092 | "overlapping axes; falling back to useblit=False." |
| 2093 | ) |
| 2094 | self.useblit = False |
| 2095 | break |
| 2096 | |
| 2097 | if self.useblit: |
| 2098 | lineprops['animated'] = True |
| 2099 | self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **lineprops) |
| 2100 | self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **lineprops) |
| 2101 | |
| 2102 | self.needclear = False |
| 2103 | |
| 2104 | def clear(self, event): |
| 2105 | """Internal event handler to clear the cursor.""" |
nothing calls this directly
no test coverage detected