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

Class Menu

tools/python-3.11.9-amd64/Lib/tkinter/__init__.py:3355–3481  ·  view source on GitHub ↗

Menu widget which allows displaying menu bars, pull-down menus and pop-up menus.

Source from the content-addressed store, hash-verified

3353
3354
3355class Menu(Widget):
3356 """Menu widget which allows displaying menu bars, pull-down menus and pop-up menus."""
3357
3358 def __init__(self, master=None, cnf={}, **kw):
3359 """Construct menu widget with the parent MASTER.
3360
3361 Valid resource names: activebackground, activeborderwidth,
3362 activeforeground, background, bd, bg, borderwidth, cursor,
3363 disabledforeground, fg, font, foreground, postcommand, relief,
3364 selectcolor, takefocus, tearoff, tearoffcommand, title, type."""
3365 Widget.__init__(self, master, 'menu', cnf, kw)
3366
3367 def tk_popup(self, x, y, entry=""):
3368 """Post the menu at position X,Y with entry ENTRY."""
3369 self.tk.call('tk_popup', self._w, x, y, entry)
3370
3371 def activate(self, index):
3372 """Activate entry at INDEX."""
3373 self.tk.call(self._w, 'activate', index)
3374
3375 def add(self, itemType, cnf={}, **kw):
3376 """Internal function."""
3377 self.tk.call((self._w, 'add', itemType) +
3378 self._options(cnf, kw))
3379
3380 def add_cascade(self, cnf={}, **kw):
3381 """Add hierarchical menu item."""
3382 self.add('cascade', cnf or kw)
3383
3384 def add_checkbutton(self, cnf={}, **kw):
3385 """Add checkbutton menu item."""
3386 self.add('checkbutton', cnf or kw)
3387
3388 def add_command(self, cnf={}, **kw):
3389 """Add command menu item."""
3390 self.add('command', cnf or kw)
3391
3392 def add_radiobutton(self, cnf={}, **kw):
3393 """Add radio menu item."""
3394 self.add('radiobutton', cnf or kw)
3395
3396 def add_separator(self, cnf={}, **kw):
3397 """Add separator."""
3398 self.add('separator', cnf or kw)
3399
3400 def insert(self, index, itemType, cnf={}, **kw):
3401 """Internal function."""
3402 self.tk.call((self._w, 'insert', index, itemType) +
3403 self._options(cnf, kw))
3404
3405 def insert_cascade(self, index, cnf={}, **kw):
3406 """Add hierarchical menu item at INDEX."""
3407 self.insert(index, 'cascade', cnf or kw)
3408
3409 def insert_checkbutton(self, index, cnf={}, **kw):
3410 """Add checkbutton menu item at INDEX."""
3411 self.insert(index, 'checkbutton', cnf or kw)
3412

Callers 11

toc_menuMethod · 0.90
overrideRootMenuFunction · 0.90
__init__Method · 0.85
__init__Method · 0.85
createmenubarMethod · 0.85
make_rmenuMethod · 0.85
make_menuMethod · 0.85
__init__Method · 0.85
makeLoadDemoMenuMethod · 0.85
makeFontMenuMethod · 0.85
makeHelpMenuMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected