(self)
| 305 | optmenu2.destroy() |
| 306 | |
| 307 | def test_trace_variable(self): |
| 308 | # prior to bpo45160, tracing a variable would cause the callback to be made twice |
| 309 | success = [] |
| 310 | items = ('a', 'b', 'c') |
| 311 | textvar = tkinter.StringVar(self.root) |
| 312 | def cb_test(*args): |
| 313 | success.append(textvar.get()) |
| 314 | optmenu = ttk.OptionMenu(self.root, textvar, "a", *items) |
| 315 | optmenu.pack() |
| 316 | cb_name = textvar.trace_add("write", cb_test) |
| 317 | optmenu['menu'].invoke(1) |
| 318 | self.assertEqual(success, ['b']) |
| 319 | self.assertEqual(textvar.get(), 'b') |
| 320 | textvar.trace_remove("write", cb_name) |
| 321 | optmenu.destroy() |
| 322 | |
| 323 | def test_specify_name(self): |
| 324 | textvar = tkinter.StringVar(self.root) |
nothing calls this directly
no test coverage detected