Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f01f6b8

Browse files
authored
Merge pull request #13942 from anntzer/enumcursors
Make Cursors an (Int)Enum.
2 parents bbd10ba + f2470a9 commit f01f6b8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/matplotlib/backend_tools.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
`matplotlib.backend_managers.ToolManager`
1212
"""
1313

14+
from enum import IntEnum
15+
import logging
1416
import re
1517
import time
16-
import logging
1718
from types import SimpleNamespace
1819
from weakref import WeakKeyDictionary
1920

@@ -26,10 +27,10 @@
2627
_log = logging.getLogger(__name__)
2728

2829

29-
class Cursors(object):
30-
"""Simple namespace for cursor reference"""
30+
class Cursors(IntEnum): # Must subclass int for the macOS backend.
31+
"""Backend-independent cursor types."""
3132
HAND, POINTER, SELECT_REGION, MOVE, WAIT = range(5)
32-
cursors = Cursors()
33+
cursors = Cursors # Backcompat.
3334

3435
# Views positions tool
3536
_views_positions = 'viewpos'

0 commit comments

Comments
 (0)