summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>2020-10-09 20:21:15 (GMT)
committerGitHub <noreply@github.com>2020-10-09 20:21:15 (GMT)
commitf8ebb7b62ea266df5c6e0f910b7a6b0eb73deee4 (patch)
treeef7dcf4476050dd035fdc3483e34e004f7086b07 /Lib
parent86938548d5829400065d2705e3d25604c14b23b7 (diff)
downloadcpython-f8ebb7b62ea266df5c6e0f910b7a6b0eb73deee4.zip
cpython-f8ebb7b62ea266df5c6e0f910b7a6b0eb73deee4.tar.gz
cpython-f8ebb7b62ea266df5c6e0f910b7a6b0eb73deee4.tar.bz2
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
(cherry picked from commit eb38c6b7aa35d3003ec0958533421902d19ce408) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/tkinter/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 479eb01..b685901 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -185,8 +185,7 @@ class EventType(str, enum.Enum):
Deactivate = '37'
MouseWheel = '38'
- def __str__(self):
- return self.name
+ __str__ = str.__str__
class Event:
@@ -266,7 +265,7 @@ class Event:
'num', 'delta', 'focus',
'x', 'y', 'width', 'height')
return '<%s event%s>' % (
- self.type,
+ getattr(self.type, 'name', self.type),
''.join(' %s=%s' % (k, attrs[k]) for k in keys if k in attrs)
)