Construct a themed OptionMenu widget with master as the parent, the option 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 st
(self, master, variable, default=None, *values, **kwargs)
| 1586 | the user to select a value from a menu.""" |
| 1587 | |
| 1588 | def __init__(self, master, variable, default=None, *values, **kwargs): |
| 1589 | """Construct a themed OptionMenu widget with master as the parent, |
| 1590 | the option textvariable set to variable, the initially selected |
| 1591 | value specified by the default parameter, the menu values given by |
| 1592 | *values and additional keywords. |
| 1593 | |
| 1594 | WIDGET-SPECIFIC OPTIONS |
| 1595 | |
| 1596 | style: stylename |
| 1597 | Menubutton style. |
| 1598 | direction: 'above', 'below', 'left', 'right', or 'flush' |
| 1599 | Menubutton direction. |
| 1600 | command: callback |
| 1601 | A callback that will be invoked after selecting an item. |
| 1602 | """ |
| 1603 | kw = {'textvariable': variable, 'style': kwargs.pop('style', None), |
| 1604 | 'direction': kwargs.pop('direction', None), |
| 1605 | 'name': kwargs.pop('name', None)} |
| 1606 | Menubutton.__init__(self, master, **kw) |
| 1607 | self['menu'] = tkinter.Menu(self, tearoff=False) |
| 1608 | |
| 1609 | self._variable = variable |
| 1610 | self._callback = kwargs.pop('command', None) |
| 1611 | if kwargs: |
| 1612 | raise tkinter.TclError('unknown option -%s' % ( |
| 1613 | next(iter(kwargs.keys())))) |
| 1614 | |
| 1615 | self.set_menu(default, *values) |
| 1616 | |
| 1617 | |
| 1618 | def __getitem__(self, item): |