print('got double left mouse click'end='showposevent(eventtkroot quit(tkroot tk(labelfont ('courier' 'bold'widget label(tkroottext='hello bind world'widget config(bg='red'font=labelfontwidget config(height= width= widget pack(expand=yesfill=bothfamilysizestyle red backgroundlarge font initial sizelines,chars widget bind(''onleftclickwidget bind(''onrightclickwidget bind(''onmiddleclickwidget bind(''ondoubleleftclickwidget bind(''onleftdragmouse button clicks widget bind(''widget bind(''widget bind(''widget focus(tkroot title('click me'tkroot mainloop(all keyboard presses arrow button pressed return/enter key pressed or bind keypress to tkroot onkeypressonarrowkeyonreturnkeymiddle=both on some mice click left twice click left and move most of this file consists of callback handler functions triggered when bound events occur as we learned in this type of callback receives an event object argument that gives details about the event that fired technicallythis argument is an instance of the tkinter event classand its details are attributesmost of the callbacks simply trace events by displaying relevant event attributes when runthis script makes the window shown in figure - it' mostly intended just as surface for clicking and pressing event triggers figure - bind window for the clicking the black-and-white medium of the book you're holding won' really do justice to this script when run liveit uses the configuration options shown earlier to make the tkinter tourpart