gui programming ii tkinter name common name enter key tab key spacebar page uppage down arrow keys homeend insertdelete caps locknumber lock left and right control keys left and right alt keys left and right shift keys most printable keys can be captured with their nameslike belowroot bind' 'callbackroot bind' 'callbackroot bind''callbackthe exceptions are the spacebar (and the less than sign (you can also catch key combinationssuch as or note these examples all bind keypresses to rootwhich is our name for the main window you can also bind keypresses to specific widgets for instanceif you only want the left arrow key to work on canvas called canvasyou could use the followingcanvas bind(callbackone trick herethoughis that the canvas won' recognize the keypress unless it has the gui' focus this can be done as belowcanvas focus_set( event examples example here is an example where the user can move rectangle with the left or right arrow keys from tkinter import def callback(event)global move if event keysym='right '