[New-bugs-announce] [issue27294] Better repr for Tkinter event objects

Serhiy Storchaka report at bugs.python.org
Sat Jun 11 08:35:57 EDT 2016


New submission from Serhiy Storchaka:

Proposed patch adds better repr for tkinter.Event objects. Currently default repr shows only class name (always the same) and object address (not interesting, since event objects are short-living). The patch makes repr showing most event attributes in human-readable form.

For testing run following script. Press any keys (with modifiers), move and click mouse, select text, move and resize the window, switch to other windows.

import tkinter
t = tkinter.Text()
t.pack()
t.bind("<<Selection>>", print)
t.bind("<<debug>>", print)
for k in tkinter.EventType:
    try:
        t.event_add("<<debug>>", '<%s>' % k)
    except tkinter.TclError:
        pass

tkinter.mainloop()

----------
components: Tkinter
messages: 268209
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Better repr for Tkinter event objects
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27294>
_______________________________________


More information about the New-bugs-announce mailing list