MCPcopy Index your code
hub / github.com/python/cpython / _dyn_option_menu

Function _dyn_option_menu

Lib/idlelib/dynoption.py:33–51  ·  view source on GitHub ↗
(parent)

Source from the content-addressed store, hash-verified

31
32
33def _dyn_option_menu(parent): # htest #
34 from tkinter import Toplevel # + StringVar, Button
35
36 top = Toplevel(parent)
37 top.title("Test dynamic option menu")
38 x, y = map(int, parent.geometry().split('+')[1:])
39 top.geometry("200x100+%d+%d" % (x + 250, y + 175))
40 top.focus_set()
41
42 var = StringVar(top)
43 var.set("Old option set") #Set the default value
44 dyn = DynOptionMenu(top, var, "old1","old2","old3","old4",
45 highlightthickness=5)
46 dyn.pack()
47
48 def update():
49 dyn.SetMenu(["new1","new2","new3","new4"], value="new option set")
50 button = Button(top, text="Change option set", command=update)
51 button.pack()
52
53
54if __name__ == '__main__':

Callers

nothing calls this directly

Calls 9

ToplevelClass · 0.90
StringVarClass · 0.90
ButtonClass · 0.90
DynOptionMenuClass · 0.85
titleMethod · 0.45
splitMethod · 0.45
focus_setMethod · 0.45
setMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…