when we meet entryand again when we study the grid manager in for more custom dialog examplessee shellgui ()pymailgui ()pycalc ()and the nonmodal form py (herewe're moving on to learn more about events that will prove to be useful currency at later tour destinations binding events we met the bind widget method in the prior when we used it to catch button presses in the tutorial because bind is commonly used in conjunction with other widgets ( to catch return key presses for input boxes)we're going to make stop early in the tour here as well example - illustrates more bind event protocols example - pp \gui\tour\bind py from tkinter import def showposevent(event)print('widget=% =% =% (event widgetevent xevent )def showallevent(event)print(eventfor attr in dir(event)if not attr startswith('__')print(attr'=>'getattr(eventattr)def onkeypress(event)print('got key press:'event chardef onarrowkey(event)print('got up arrow key press'def onreturnkey(event)print('got return key press'def onleftclick(event)print('got left mouse button click:'end='showposevent(eventdef onrightclick(event)print('got right mouse button click:'end='showposevent(eventdef onmiddleclick(event)print('got middle mouse button click:'end='showposevent(eventshowallevent(eventdef onleftdrag(event)print('got left mouse button drag:'end='showposevent(eventbinding events