diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-10-09 19:57:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 19:57:34 (GMT) |
commit | eb38c6b7aa35d3003ec0958533421902d19ce408 (patch) | |
tree | 41ad1816f8c20e096e6c19318355966cab8eab37 /Lib/tkinter | |
parent | f25323a307a72c40862c87c2df822f83be6645da (diff) | |
download | cpython-eb38c6b7aa35d3003ec0958533421902d19ce408.zip cpython-eb38c6b7aa35d3003ec0958533421902d19ce408.tar.gz cpython-eb38c6b7aa35d3003ec0958533421902d19ce408.tar.bz2 |
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355)
Diffstat (limited to 'Lib/tkinter')
-rw-r--r-- | Lib/tkinter/__init__.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 3919397..3bfeb7a 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -185,8 +185,7 @@ class EventType(enum.StrEnum): 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) ) |