bpo-27313: Use non-deprecated methods for tracing (GH-29425)

This commit is contained in:
Serhiy Storchaka 2021-11-06 21:01:39 +02:00 committed by GitHub
parent 57457a1e5c
commit cc1cbcbb2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -307,14 +307,14 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase):
items = ('a', 'b', 'c')
textvar = tkinter.StringVar(self.root)
def cb_test(*args):
self.assertEqual(textvar.get(), items[1])
success.append(True)
success.append(textvar.get())
optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
optmenu.pack()
cb_name = textvar.trace("w", cb_test)
cb_name = textvar.trace_add("write", cb_test)
optmenu['menu'].invoke(1)
self.assertEqual(success, [True])
textvar.trace_vdelete("w", cb_name)
self.assertEqual(success, ['b'])
self.assertEqual(textvar.get(), 'b')
textvar.trace_remove("write", cb_name)
optmenu.destroy()