Save a blit background. The background is stored on the canvas in a uniquely identifiable way. It should be read back via `._load_blit_background`. Be prepared that some events may invalidate the background, in which case `._load_blit_background` will return
(self, background)
| 147 | self.ax.get_figure(root=True).canvas.set_cursor(cursor) |
| 148 | |
| 149 | def _save_blit_background(self, background): |
| 150 | """ |
| 151 | Save a blit background. |
| 152 | |
| 153 | The background is stored on the canvas in a uniquely identifiable way. |
| 154 | It should be read back via `._load_blit_background`. Be prepared that |
| 155 | some events may invalidate the background, in which case |
| 156 | `._load_blit_background` will return None. |
| 157 | |
| 158 | This currently allows at most one background per widget, which is |
| 159 | good enough for all existing widgets. |
| 160 | """ |
| 161 | if self._blit_background_id is None: |
| 162 | bbid = self.canvas._get_blit_background_id() |
| 163 | weakref.finalize(self, self.canvas._release_blit_background_id, bbid) |
| 164 | self._blit_background_id = bbid |
| 165 | self.canvas._blit_backgrounds[self._blit_background_id] = background |
| 166 | |
| 167 | def _load_blit_background(self): |
| 168 | """Load a blit background; may be None at any time.""" |
no test coverage detected