Mar-07-2020, 01:26 AM
in the bind statement, <key> needs to be replaced with what you want to bind to,
and func needs to be replaces with the name of a function that you want to run when the event occurs.
Since you are not using a class, the 'func' must be defined with a 'def' prior to the bind statement which you have done.
you need to capture the event as an attribute of 'func' (I'd choose a better name here) and finally
the bind must be for a widget, not a window
assume you wanted to use left mouse button to bind to Entry a when enter button is pressed, the statement should look like:
and func needs to be replaces with the name of a function that you want to run when the event occurs.
Since you are not using a class, the 'func' must be defined with a 'def' prior to the bind statement which you have done.
you need to capture the event as an attribute of 'func' (I'd choose a better name here) and finally
the bind must be for a widget, not a window
assume you wanted to use left mouse button to bind to Entry a when enter button is pressed, the statement should look like:
a.bind('<Return>', func)