MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / __init__

Method __init__

tools/python-3.11.9-amd64/Lib/tkinter/ttk.py:1578–1604  ·  view source on GitHub ↗

Construct a themed OptionMenu widget with master as the parent, the resource textvariable set to variable, the initially selected value specified by the default parameter, the menu values given by *values and additional keywords. WIDGET-SPECIFIC OPTIONS

(self, master, variable, default=None, *values, **kwargs)

Source from the content-addressed store, hash-verified

1576 the user to select a value from a menu."""
1577
1578 def __init__(self, master, variable, default=None, *values, **kwargs):
1579 """Construct a themed OptionMenu widget with master as the parent,
1580 the resource textvariable set to variable, the initially selected
1581 value specified by the default parameter, the menu values given by
1582 *values and additional keywords.
1583
1584 WIDGET-SPECIFIC OPTIONS
1585
1586 style: stylename
1587 Menubutton style.
1588 direction: 'above', 'below', 'left', 'right', or 'flush'
1589 Menubutton direction.
1590 command: callback
1591 A callback that will be invoked after selecting an item.
1592 """
1593 kw = {'textvariable': variable, 'style': kwargs.pop('style', None),
1594 'direction': kwargs.pop('direction', None)}
1595 Menubutton.__init__(self, master, **kw)
1596 self['menu'] = tkinter.Menu(self, tearoff=False)
1597
1598 self._variable = variable
1599 self._callback = kwargs.pop('command', None)
1600 if kwargs:
1601 raise tkinter.TclError('unknown option -%s' % (
1602 next(iter(kwargs.keys()))))
1603
1604 self.set_menu(default, *values)
1605
1606
1607 def __getitem__(self, item):

Callers

nothing calls this directly

Calls 4

set_menuMethod · 0.95
popMethod · 0.45
__init__Method · 0.45
keysMethod · 0.45

Tested by

no test coverage detected