mirror of https://github.com/python/cpython
bpo-27313: Use non-deprecated methods for tracing (GH-29425)
This commit is contained in:
parent
57457a1e5c
commit
cc1cbcbb2d
|
@ -307,14 +307,14 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase):
|
||||||
items = ('a', 'b', 'c')
|
items = ('a', 'b', 'c')
|
||||||
textvar = tkinter.StringVar(self.root)
|
textvar = tkinter.StringVar(self.root)
|
||||||
def cb_test(*args):
|
def cb_test(*args):
|
||||||
self.assertEqual(textvar.get(), items[1])
|
success.append(textvar.get())
|
||||||
success.append(True)
|
|
||||||
optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
|
optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
|
||||||
optmenu.pack()
|
optmenu.pack()
|
||||||
cb_name = textvar.trace("w", cb_test)
|
cb_name = textvar.trace_add("write", cb_test)
|
||||||
optmenu['menu'].invoke(1)
|
optmenu['menu'].invoke(1)
|
||||||
self.assertEqual(success, [True])
|
self.assertEqual(success, ['b'])
|
||||||
textvar.trace_vdelete("w", cb_name)
|
self.assertEqual(textvar.get(), 'b')
|
||||||
|
textvar.trace_remove("write", cb_name)
|
||||||
optmenu.destroy()
|
optmenu.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue