Python Forum
[Tkinter] moniter which widget triggerd event
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] moniter which widget triggerd event
#4
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:
a.bind('<Return>', func)
Reply


Messages In This Thread
RE: moniter which widget triggerd event - by Larz60+ - Mar-07-2020, 01:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] What can the event.widget reference be used for? Knickers 4 2,398 Aug-26-2021, 02:17 PM
Last Post: Knickers
  pygtk2, how to disconnect all callback of widget or window event ? harun2525 1 3,262 Feb-19-2017, 11:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020