code: def test_bind_events(self):
      event = "<Enter>"
      root = self.root
      t = tkinter.Toplevel(root)
      f = tkinter.Frame(t, class_="Test", width=150, height=100)
      f.pack()
      root.wait_visibility()  # needed on Windows
      root.update_idletasks()
      self.addCleanup(root.unbind_class, "Test", event)
      self.addCleanup(root.unbind_class, "Toplevel", event)
      self.addCleanup(root.unbind_class, "tag", event)
      self.addCleanup(root.unbind_class, "tag2", event)
      self.addCleanup(root.unbind_all, event)
  
      def test(what):
          return lambda e: events.append((what, e.widget))
  
      root.bind_all(event, test("all"))
      root.bind_class("Test", event, test("frame class"))
      root.bind_class("Toplevel", event, test("toplevel class"))
      root.bind_class("tag", event, test("tag"))
      root.bind_class("tag2", event, test("tag2"))
      f.bind(event, test("frame"))
      t.bind(event, test("toplevel"))
  
      events = []
      f.event_generate(event)
      self.assertEqual(
          events,
          [
              ("frame", f),
              ("frame class", f),
              ("toplevel", f),
              ("all", f),
          ],
      )
  
      events = []
      t.event_generate(event)
      self.assertEqual(
          events,
          [
              ("toplevel", t),
              ("toplevel class", t),
              ("all", t),
          ],
      )
  
      f.bindtags(("tag", "tag3"))
      events = []
      f.event_generate(event)
      self.assertEqual(events, [("tag", f)])
  
imports: import functools
  import unittest
  import tkinter
  from tkinter import TclError
  import enum
  from test import support
  from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest, requires_tk
label_desc: Use image node_id 15 for calling the BindTest obj's underlying member method code with example usage: obj.test_bind_events() and returns: function