Plugins | Developer's Guide | Message Passing

# User Interface

## Commands

Commands (or command objects), represent a command that can be invoked by the user. Menu items and buttons are not directly connected to methods of the canvas or the document, but are connected to these commands.

A command object knows how to invoke the command (i.e. which method of which object to call with which arguments) and how to update itself. This update is done by calling several callbacks. The following attributes are updated:

Menu Name

  The text to display in a menu entry. The only commands that use this currently are Undo and Redo. They use it to indicate what action would be undone or redone.

Sensitivity

  Whether the command is available at the moment or not. Most commands have a callback for this because this attribute determines whether the associated widgets (menu items or buttons) are grayed out or not.

Value

  The value is used by check command objects to determine whether they are checked or not. In the current implementation this value is used as the value of a Tkinter IntVar which is associated with a widget (or menu item), so it should be true for `checked' and false for `unchecked'.

Whenever, during an update, at least one of the attributes change, all menu items or other associated widgets are notified and also updated.

A command object can be associated with any number of widgets or menu items.

Plugins | Developer's Guide | Message Passing