MCPcopy
hub / github.com/nltk/nltk / __init__

Method __init__

nltk/draw/util.py:2455–2483  ·  view source on GitHub ↗
(self, master, values, **options)

Source from the content-addressed store, hash-verified

2453
2454class MutableOptionMenu(Menubutton):
2455 def __init__(self, master, values, **options):
2456 self._callback = options.get("command")
2457 if "command" in options:
2458 del options["command"]
2459
2460 # Create a variable
2461 self._variable = variable = StringVar()
2462 if len(values) > 0:
2463 variable.set(values[0])
2464
2465 kw = {
2466 "borderwidth": 2,
2467 "textvariable": variable,
2468 "indicatoron": 1,
2469 "relief": RAISED,
2470 "anchor": "c",
2471 "highlightthickness": 2,
2472 }
2473 kw.update(options)
2474 Widget.__init__(self, master, "menubutton", kw)
2475 self.widgetName = "tk_optionMenu"
2476 self._menu = Menu(self, name="menu", tearoff=0)
2477 self.menuname = self._menu._w
2478
2479 self._values = []
2480 for value in values:
2481 self.add(value)
2482
2483 self["menu"] = self._menu
2484
2485 def add(self, value):
2486 if value in self._values:

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
getMethod · 0.45
setMethod · 0.45
updateMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected