code: def test_trace_variable(self):
      # prior to bpo45160, tracing a variable would cause the callback to be made twice
      success = []
      items = ("a", "b", "c")
      textvar = tkinter.StringVar(self.root)
  
      def cb_test(*args):
          success.append(textvar.get())
  
      optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
      optmenu.pack()
      cb_name = textvar.trace_add("write", cb_test)
      optmenu["menu"].invoke(1)
      self.assertEqual(success, ["b"])
      self.assertEqual(textvar.get(), "b")
      textvar.trace_remove("write", cb_name)
      optmenu.destroy()
  
imports: import sys
  import unittest
  import tkinter
  from tkinter import ttk
  from test.support import requires, gc_collect
  from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest
label_desc: Use image node_id 7 for calling the OptionMenuTest obj's underlying member method code with example usage: obj.test_trace_variable() without return types