Teek API Documentation

The build surface inside a menu_bar/menu/context_menu block - a separate, small vocabulary from WidgetDSL (deliberately NOT mixed into Session/yielded as self the way ordinary containers are), since menu entries reuse names ordinary widgets already own (checkbox/radio are ttk widgets one level up, menu entry kinds one level down here) - a shared receiver would collide.

Menu structure realizes through Realizer#create_menu_tree rather than the generic per-node widget-creation path: nothing here is a Tk widget of its own except #menu (a nested cascade, itself a menu command) - #item/#checkbox/#radio are entries added to their parent’s menu path, with no live Tk path of their own, addressed via their WidgetType#addressing strategy (MenuEntryAddressing) the same way Handle resolves any other type’s - see WidgetDSL#[]. #separator stays unaddressable (nothing to enable/disable/relabel on a divider).

Inherits: Object

Instance Methods

checkbox(name nil, label:, bind:, **opts)

A checkbutton entry, bound to a reactive Var - ticked when the var is true, unticked when false, the same bind: convention WidgetDSL’s own checkbox widget uses.

Parameters
  • name Symbol, nil — see #item
  • label String
  • bind Var
  • opts Hash — extra Tk menu-entry options

Returns Handle

initialize(document, stack)

Returns MenuBuilder — a new instance of MenuBuilder

@api private

item(name nil, label:, **opts, &block)

A command entry.

Parameters
  • name Symbol, nil — for `ui[:name]` lookup - addressable later as a Handle (`.enable`/`.disable`/`.configure`)
  • label String
  • opts Hash — extra Tk menu-entry options (e.g. accelerator:)

Returns Handle

@yield called when the entry is invoked

menu(name nil, label:, **opts, &block)

A nested cascade - recursive, so the same method builds both a menu_bar’s top-level dropdowns (File/Edit/…) and any submenu nested inside one of those.

Parameters
  • name Symbol, nil
  • label String — the cascade's displayed label
  • opts Hash — extra Tk menu-entry options (e.g. underline:)

Returns Handle

@yieldparam m MenuBuilder this same builder, scoped to the new menu

radio(name nil, label:, bind:, value:, **opts)

A radiobutton entry - bind: is shared across every radio entry in the group, value: is what this one entry sets it to when chosen.

Parameters
  • name Symbol, nil — see #item
  • label String
  • bind Var
  • value Object
  • opts Hash — extra Tk menu-entry options

Returns Handle

separator

A separator entry.

Returns nil