Skip to content

Commit a0af7cc

Browse files
authored
Merge pull request #22294 from daniilS/tk_cursor
Add set_cursor method to FigureCanvasTk
2 parents 528745f + c540af5 commit a0af7cc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/matplotlib/backends/_backend_tk.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,12 @@ def stop_event_loop(self):
387387
self._event_loop_id = None
388388
self._tkcanvas.quit()
389389

390+
def set_cursor(self, cursor):
391+
try:
392+
self._tkcanvas.configure(cursor=cursord[cursor])
393+
except tkinter.TclError:
394+
pass
395+
390396

391397
class FigureManagerTk(FigureManagerBase):
392398
"""
@@ -629,13 +635,6 @@ def remove_rubberband(self):
629635
lastrect = _api.deprecated("3.6")(
630636
property(lambda self: self.canvas._rubberband_rect))
631637

632-
def set_cursor(self, cursor):
633-
window = self.canvas.get_tk_widget().master
634-
try:
635-
window.configure(cursor=cursord[cursor])
636-
except tkinter.TclError:
637-
pass
638-
639638
def _set_image_for_button(self, button):
640639
"""
641640
Set the image for a button based on its pixel size.

0 commit comments

Comments
 (0)