Difference between revisions of "Development Team/Almanac/sugar.graphics.toolbox"

From Sugar Labs
Jump to navigation Jump to search
Line 9: Line 9:
  
 
=== How do I add a toolbar to a toolbox? ===
 
=== How do I add a toolbar to a toolbox? ===
 +
Toolbars can be added to a toolbox using add_toolbar(). Just provide a name for the toolbar as well as a handle on the toolbar object that has been created.
 +
        # Add the edit toolbar:
 +
        toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
  
 
=== How do I remove a toolbar from a toolbox? ===
 
=== How do I remove a toolbar from a toolbox? ===
  
 
=== How do I programmatically change the active toolbar in a toolbox? ===
 
=== How do I programmatically change the active toolbar in a toolbox? ===

Revision as of 16:14, 2 June 2008

Class: Toolbox(gtk.VBox)

How do I retrieve the index of the current toolbar in the toolbox?

Toolboxes arrange toolbars in some order and assign each toolbar to an index. Currently, the implementation appends newly added toolbars to the end of a list, so integral indexes for toolbars are incremented by one for each new toolbar. The following code fragment shows how to get the index of a toolbar in your toolbox:

       #retrieve the index of the active toolbar in toolbox
       toolbarNum = toolbox.get_current_toolbar()

How do I add a toolbar to a toolbox?

Toolbars can be added to a toolbox using add_toolbar(). Just provide a name for the toolbar as well as a handle on the toolbar object that has been created.

       # Add the edit toolbar:
       toolbox.add_toolbar(_('Edit'), self._edit_toolbar)

How do I remove a toolbar from a toolbox?

How do I programmatically change the active toolbar in a toolbox?