[issue27294] Better repr for Tkinter event objects

Terry J. Reedy report at bugs.python.org
Sat Jun 11 12:34:40 EDT 2016


Terry J. Reedy added the comment:

+1! This would be helpful for exploration and quite possibly for tests.  Earlier this year, I bound <Button-1> to a custom function(event) printing event.x, event.y so I could discover how the line thickness of Canvas rectangles was distributed inside and outside the nominal dimensions. (Using a magnifier to click on exact pixels, I discovered the rule.) Being able to bind to print instead have been nice. 

There is no patch uploaded.  In the absence of seeing what you did... Event.type should be decoded.  The hex address should be replaced by at least the widget class, if not its path name (which would make readable names imperative!) The Event representation should be customized to the event type.

For me, there is no tkinter.EventType. The <<Selection>> binding worked to prove the idea.

----------

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


More information about the Python-bugs-list mailing list