I'd like to know how to add a shortcut to a menu item. I already had to search and I saw that it can be done using a special function common to all widgets of the tkinker
module, that is the bind
function.
What I tried to do was this:
menu_file.add_command(label="Exit", command=exitf, accelerator="Ctrl+Q")
menu_file.bind("<Control-Q>", exitf)
where exitf
is a function that closes the application.
But I honestly did not see exactly how this bind
function works or the other one called bind_all
.
What I realized was that the first parameter is the event and the second is the handler, could you explain me better and more in detail how they work or tell me a good site where I can study it?