wx.ToolBar

A toolbar is a bar of buttons and/or other controls usually placed below the menu bar in a wx.Frame.

You may create a toolbar that is managed by a frame calling wx.Frame.CreateToolBar . Under Pocket PC, you should always use this function for creating the toolbar to be managed by the frame, so that wxWidgets can use a combined menubar and toolbar. Where you manage your own toolbars, create wx.ToolBar as usual.

There are several different types of tools you can add to a toolbar. These types are controlled by the wx.ItemKind enumeration.

Note that many methods in wx.ToolBar such as wx.ToolBar.AddTool return a ToolBarToolBase* object. This should be regarded as an opaque handle representing the newly added toolbar item, providing access to its id and position within the toolbar. Changes to the item’s state should be made through calls to wx.ToolBar methods, for example wx.ToolBar.EnableTool . Calls to wx.ToolBarToolBase methods (undocumented by purpose) will not change the visible state of the item within the tool bar.

wxMSW note: Note that under wxMSW toolbar paints tools to reflect system-wide colours. If you use more than 16 colours in your tool bitmaps, you may wish to suppress this behaviour, otherwise system colours in your bitmaps will inadvertently be mapped to system colours. To do this, set the msw.remap system option before creating the toolbar:

wx.SystemOptions.SetOption("msw.remap", 0)

If you wish to use 32-bit images (which include an alpha channel for transparency) use:

wx.SystemOptions.SetOption("msw.remap", 2)

Then colour remapping is switched off, and a transparent background used. But only use this option under Windows XP with True colour:

if wx.GetApp().GetComCtl32Version() >= 600 and wx.DisplayDepth() >= 32:
# Use the 32-bit images
wx.SystemOptions.SetOption("msw.remap", 2)

 Window Styles

This class supports the following styles:

  • wx.TB_FLAT: Gives the toolbar a flat look (Windows and GTK only).
  • wx.TB_DOCKABLE: Makes the toolbar floatable and dockable (GTK only).
  • wx.TB_HORIZONTAL: Specifies horizontal layout (default).
  • wx.TB_VERTICAL: Specifies vertical layout.
  • wx.TB_TEXT: Shows the text in the toolbar buttons; by default only icons are shown.
  • wx.TB_NOICONS: Specifies no icons in the toolbar buttons; by default they are shown.
  • wx.TB_NODIVIDER: Specifies no divider (border) above the toolbar (Windows only)
  • wx.TB_NOALIGN: Specifies no alignment with the parent window (Windows only, not very useful).
  • wx.TB_HORZ_LAYOUT: Shows the text and the icons alongside, not vertically stacked (Windows and GTK 2 only). This style must be used with TB_TEXT .
  • wx.TB_HORZ_TEXT: Combination of TB_HORZ_LAYOUT and TB_TEXT .
  • wx.TB_NO_TOOLTIPS: Don’t show the short help tooltips for the tools when the mouse hovers over them.
  • wx.TB_BOTTOM: Align the toolbar at the bottom of parent window.
  • wx.TB_RIGHT: Align the toolbar at the right side of parent window.
  • wx.TB_DEFAULT_STYLE: Combination of TB_HORIZONTAL and TB_FLAT . This style is new since wxWidgets 2.9.5.

See also

Window Styles. Note that the wxMSW native toolbar ignores TB_NOICONS style. Also, toggling the TB_TEXT works only if the style was initially on.

 Events Emitted by this Class

Handlers bound for the following event types will receive a wx.CommandEvent parameter.

  • EVT_TOOL: Process a wxEVT_TOOL event (a synonym for wxEVT_MENU ). Pass the id of the tool.
  • EVT_MENU: The same as EVT_TOOL().
  • EVT_TOOL_RANGE: Process a wxEVT_TOOL event for a range of identifiers. Pass the ids of the tools.
  • EVT_MENU_RANGE: The same as EVT_TOOL_RANGE().
  • EVT_TOOL_RCLICKED: Process a wxEVT_TOOL_RCLICKED event. Pass the id of the tool. (Not available on wxOSX.)
  • EVT_TOOL_RCLICKED_RANGE: Process a wxEVT_TOOL_RCLICKED event for a range of ids. Pass the ids of the tools. (Not available on wxOSX.)
  • EVT_TOOL_ENTER: Process a wxEVT_TOOL_ENTER event. Pass the id of the toolbar itself. The value of wx.CommandEvent.GetSelection is the tool id, or -1 if the mouse cursor has moved off a tool. (Not available on wxOSX.)
  • EVT_TOOL_DROPDOWN: Process a wxEVT_TOOL_DROPDOWN event. If unhandled, displays the default dropdown menu set using wx.ToolBar.SetDropdownMenu .

The toolbar class emits menu commands in the same way that a frame menubar does, so you can use one EVT_MENU() macro for both a menu item and a toolbar button. The event handler functions take a wx.CommandEvent argument. For most event macros, the identifier of the tool is passed, but for EVT_TOOL_ENTER() the toolbar window identifier is passed and the tool identifier is retrieved from the wx.CommandEvent. This is because the identifier may beID_ANY when the mouse moves off a tool, and ID_ANY is not allowed as an identifier in the event system.

See also

Toolbar Overview

 

 Class Hierarchy

 Inheritance diagram for class ToolBar:

 

 Methods Summary

__init__ Default constructor.
AddCheckTool Adds a new check (or toggle) tool to the toolbar.
AddControl Adds any control to the toolbar, typically e.g. a wx.ComboBox.
AddLabelTool Old style method to add a tool in the toolbar.
AddRadioTool Adds a new radio tool to the toolbar.
AddSeparator Adds a separator for spacing groups of tools.
AddSimpleTool Old style method to add a tool to the toolbar.
AddStretchableSpace Adds a stretchable space to the toolbar.
AddTool Adds a tool to the toolbar.
ClearTools Deletes all the tools in the toolbar.
CreateTool Factory function to create a new toolbar tool.
DeleteTool Removes the specified tool from the toolbar and deletes it.
DeleteToolByPos This function behaves like DeleteTool but it deletes the tool at the specified position and not the one with the given id.
EnableTool Enables or disables the tool.
FindById Returns a pointer to the tool identified by id or None if no corresponding tool is found.
FindControl Returns a pointer to the control identified by id or None if no corresponding control is found.
FindToolForPosition Finds a tool for the given mouse position.
GetMargins Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.
GetToolBitmapSize Returns the size of bitmap that the toolbar expects to have.
GetToolByPos Returns a pointer to the tool at ordinal position pos.
GetToolClientData Get any client data associated with the tool.
GetToolEnabled Called to determine whether a tool is enabled (responds to user input).
GetToolLongHelp Returns the long help for the given tool.
GetToolPacking Returns the value used for packing tools.
GetToolPos Returns the tool position in the toolbar, or NOT_FOUND if the tool is not found.
GetToolSeparation Returns the default separator size.
GetToolShortHelp Returns the short help for the given tool.
GetToolSize Returns the size of a whole button, which is usually larger than a tool bitmap because of added 3D effects.
GetToolState Gets the on/off state of a toggle tool.
GetToolsCount Returns the number of tools in the toolbar.
InsertControl Inserts the control into the toolbar at the given position.
InsertLabelTool Old style method to insert a tool in the toolbar.
InsertSeparator Inserts the separator into the toolbar at the given position.
InsertSimpleTool Old style method to insert a tool in the toolbar.
InsertStretchableSpace Inserts a stretchable space at the given position.
InsertTool Inserts the tool with the specified attributes into the toolbar at the given position.
Realize This function should be called after you have added tools.
RemoveTool Removes the given tool from the toolbar but doesn’t delete it.
SetDropdownMenu Sets the dropdown menu for the tool given by its id.
SetMargins Set the values to be used as margins for the toolbar.
SetToolBitmapSize Sets the default size of each tool bitmap.
SetToolClientData Sets the client data associated with the tool.
SetToolDisabledBitmap Sets the bitmap to be used by the tool with the given ID when the tool is in a disabled state.
SetToolLongHelp Sets the long help for the given tool.
SetToolNormalBitmap Sets the bitmap to be used by the tool with the given ID.
SetToolPacking Sets the value used for spacing tools.
SetToolSeparation Sets the default separator size.
SetToolShortHelp Sets the short help for the given tool.
ToggleTool Toggles a tool on or off.
 

 Class API


class wx.ToolBar(Control)

Possible constructors:

ToolBar()

ToolBar(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
style=TB_HORIZONTAL, name=ToolBarNameStr)

A toolbar is a bar of buttons and/or other controls usually placed below the menu bar in a Frame.

Methods


__init__(self*args**kw)

 Overloaded Implementations:


__init__ (self)

Default constructor.


__init__ (self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TB_HORIZONTAL, name=ToolBarNameStr)

Constructs a toolbar.

Parameters:
  • parent (wx.Window) – Pointer to a parent window.
  • id (wx.WindowID) – Window identifier. If -1, will automatically create an identifier.
  • pos (wx.Point) – Window position. wx.DefaultPosition indicates that wxWidgets should generate a default position for the window. If using the wx.Window class directly, supply an actual position.
  • size (wx.Size) – Window size. wx.DefaultSize indicates that wxWidgets should generate a default size for the window.
  • style (long) – Window style. See wx.ToolBar initial description for details.
  • name (string) – Window name.

Note

After a toolbar is created, you use AddTool and perhaps AddSeparator , and then you must call Realize to construct and display the toolbar tools.



AddCheckTool(selftoolIdlabelbitmap1bmpDisabled=NullBitmapshortHelp=""longHelp=""clientData=None)

Adds a new check (or toggle) tool to the toolbar.

The parameters are the same as in AddTool .

Parameters:
  • toolId (int) –
  • label (string) –
  • bitmap1 (wx.Bitmap) –
  • bmpDisabled (wx.Bitmap) –
  • shortHelp (string) –
  • longHelp (string) –
  • clientData (PyUserData) –
Return type:

wx.ToolBarToolBase

See also

AddTool


AddControl(selfcontrollabel="")

Adds any control to the toolbar, typically e.g. a wx.ComboBox.

Parameters:
  • control (wx.Control) – The control to be added.
  • label (string) – Text to be displayed near the control.
Return type:

wx.ToolBarToolBase

Note

wxMSW: the label is only displayed if there is enough space available below the embedded control.

Note

Mac: labels are only displayed if wxWidgets is built with MAC_USE_NATIVE_TOOLBAR set to 1


AddLabelTool(selfidlabelbitmapbmpDisabled=wx.NullBitmapkind=wx.ITEM_NORMALshortHelp=""longHelp=""clientData=None)

Old style method to add a tool in the toolbar.

Deprecated since version 3.0.3: Use AddTool instead.


AddRadioTool(selftoolIdlabelbitmap1bmpDisabled=NullBitmapshortHelp=""longHelp=""clientData=None)

Adds a new radio tool to the toolbar.

Consecutive radio tools form a radio group such that exactly one button in the group is pressed at any moment, in other words whenever a button in the group is pressed the previously pressed button is automatically released. You should avoid having the radio groups of only one element as it would be impossible for the user to use such button.

By default, the first button in the radio group is initially pressed, the others are not.

Parameters:
  • toolId (int) –
  • label (string) –
  • bitmap1 (wx.Bitmap) –
  • bmpDisabled (wx.Bitmap) –
  • shortHelp (string) –
  • longHelp (string) –
  • clientData (PyUserData) –
Return type:

wx.ToolBarToolBase

See also

AddTool


AddSeparator(self)

Adds a separator for spacing groups of tools.

Notice that the separator uses the look appropriate for the current platform so it can be a vertical line (MSW, some versions of GTK) or just an empty space or something else.

Return type: wx.ToolBarToolBase


AddSimpleTool(selftoolIdbitmapshortHelpString=""longHelpString=""isToggle=0)

Old style method to add a tool to the toolbar.

Deprecated since version 3.0.3: Use AddTool instead.


AddStretchableSpace(self)

Adds a stretchable space to the toolbar.

Any space not taken up by the fixed items (all items except for stretchable spaces) is distributed in equal measure between the stretchable spaces in the toolbar. The most common use for this method is to add a single stretchable space before the items which should be right-aligned in the toolbar, but more exotic possibilities are possible, e.g. a stretchable space may be added in the beginning and the end of the toolbar to centre all toolbar items.

Return type: wx.ToolBarToolBase

New in version 2.9.1.


AddTool(self*args**kw)

 Overloaded Implementations:


AddTool (self, tool)

Adds a tool to the toolbar.

Parameters: tool (wx.ToolBarToolBase) – The tool to be added.
Return type: wx.ToolBarToolBase

Note

After you have added tools to a toolbar, you must call Realize in order to have the tools appear.


AddTool (self, toolId, label, bitmap, shortHelp=””, kind=ITEM_NORMAL)

Adds a tool to the toolbar.

This most commonly used version has fewer parameters than the full version below which specifies the more rarely used button features.

Parameters:
  • toolId (int) – An integer by which the tool may be identified in subsequent operations.
  • label (string) – The string to be displayed with the tool.
  • bitmap (wx.Bitmap) – The primary tool bitmap.
  • shortHelp (string) – This string is used for the tools tooltip.
  • kind (ItemKind) – May be ITEM_NORMAL for a normal button (default), ITEM_CHECK for a checkable tool (such tool stays pressed after it had been toggled) or ITEM_RADIO for a checkable tool which makes part of a radio group of tools each of which is automatically unchecked whenever another button in the group is checked. ITEM_DROPDOWN specifies that a drop-down menu button will appear next to the tool button (only GTK+ and MSW). Call SetDropdownMenu afterwards.
Return type:

wx.ToolBarToolBase

Note

After you have added tools to a toolbar, you must call Realize in order to have the tools appear.


AddTool (self, toolId, label, bitmap, bmpDisabled, kind=ITEM_NORMAL, shortHelpString=””, longHelpString=””, clientData=None)

Adds a tool to the toolbar.

Parameters:
  • toolId (int) – An integer by which the tool may be identified in subsequent operations.
  • label (string) – The string to be displayed with the tool.
  • bitmap (wx.Bitmap) – The primary tool bitmap.
  • bmpDisabled (wx.Bitmap) – The bitmap used when the tool is disabled. If it is equal to wx.NullBitmap (default), the disabled bitmap is automatically generated by greying the normal one.
  • kind (ItemKind) – May be ITEM_NORMAL for a normal button (default), ITEM_CHECK for a checkable tool (such tool stays pressed after it had been toggled) or ITEM_RADIO for a checkable tool which makes part of a radio group of tools each of which is automatically unchecked whenever another button in the group is checked. ITEM_DROPDOWN specifies that a drop-down menu button will appear next to the tool button (only GTK+ and MSW). Call SetDropdownMenu afterwards.
  • shortHelpString (string) – This string is used for the tools tooltip.
  • longHelpString (string) – This string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the tool.
  • clientData (PyUserData) – An optional pointer to client data which can be retrieved later using GetToolClientData .
Return type:

wx.ToolBarToolBase

Note

After you have added tools to a toolbar, you must call Realize in order to have the tools appear.



ClearTools(self)

Deletes all the tools in the toolbar.


CreateTool(self*args**kw)

 Overloaded Implementations:


CreateTool (self, toolId, label, bmpNormal, bmpDisabled=NullBitmap, kind=ITEM_NORMAL, clientData=None, shortHelp=””, longHelp=””)

Factory function to create a new toolbar tool.

Parameters:
  • toolId (int) –
  • label (string) –
  • bmpNormal (wx.Bitmap) –
  • bmpDisabled (wx.Bitmap) –
  • kind (ItemKind) –
  • clientData (PyUserData) –
  • shortHelp (string) –
  • longHelp (string) –
Return type:

wx.ToolBarToolBase


CreateTool (self, control, label)

Factory function to create a new control toolbar tool.

Parameters:
Return type:

wx.ToolBarToolBase



DeleteTool(selftoolId)

Removes the specified tool from the toolbar and deletes it.

If you don’t want to delete the tool, but just to remove it from the toolbar (to possibly add it back later), you may use RemoveTool instead.

Parameters: toolId (int) –
Return type: bool
Returns: True if the tool was deleted, False otherwise.

Note

It is unnecessary to call Realize for the change to take place, it will happen immediately.

See also

DeleteToolByPos


DeleteToolByPos(selfpos)

This function behaves like DeleteTool but it deletes the tool at the specified position and not the one with the given id.

Parameters: pos (int) –
Return type: bool


EnableTool(selftoolIdenable)

Enables or disables the tool.

Parameters:
  • toolId (int) – ID of the tool to enable or disable, as passed to AddTool .
  • enable (bool) – If True, enables the tool, otherwise disables it.

Note

Some implementations will change the visible state of the tool to indicate that it is disabled.

See also

GetToolEnabled , ToggleTool


FindById(selfid)

Returns a pointer to the tool identified by id or None if no corresponding tool is found.

Parameters: id (int) –
Return type: wx.ToolBarToolBase


FindControl(selfid)

Returns a pointer to the control identified by id or None if no corresponding control is found.

Parameters: id (int) –
Return type: wx.Control


FindToolForPosition(selfxy)

Finds a tool for the given mouse position.

Parameters:
  • x (int) – X position.
  • y (int) – Y position.
Return type:

wx.ToolBarToolBase

Returns:

A pointer to a tool if a tool is found, or None otherwise.

Note

Currently not implemented in wxGTK (always returns None there).


GetMargins(self)

Returns the left/right and top/bottom margins, which are also used for inter-toolspacing.

Return type: wx.Size

See also

SetMargins


GetToolBitmapSize(self)

Returns the size of bitmap that the toolbar expects to have.

The default bitmap size is platform-dependent: for example, it is 16x15 for MSW and 24x24 for GTK. This size does not necessarily indicate the best size to use for the toolbars on the given platform, for this you should use ArtProvider::GetNativeSizeHint(wxART_TOOLBAR) but in any case, as the bitmap size is deduced automatically from the size of the bitmaps associated with the tools added to the toolbar, it is usually unnecessary to call SetToolBitmapSize explicitly.

Return type: wx.Size

Note

Note that this is the size of the bitmap you pass to AddTool , and not the eventual size of the tool button.


GetToolByPos(selfpos)

Returns a pointer to the tool at ordinal position pos.

Don’t confuse this with FindToolForPosition .

Parameters: pos (int) –
Return type: wx.ToolBarToolBase

New in version 2.9.1.

See also

GetToolsCount


GetToolClientData(selftoolId)

Get any client data associated with the tool.

Parameters: toolId (int) – ID of the tool in question, as passed to AddTool .
Return type: PyUserData
Returns: Client data, or None if there is none.


GetToolEnabled(selftoolId)

Called to determine whether a tool is enabled (responds to user input).

Parameters: toolId (int) – ID of the tool in question, as passed to AddTool .
Return type: bool
Returns: True if the tool is enabled, False otherwise.

See also

EnableTool


GetToolLongHelp(selftoolId)

Returns the long help for the given tool.

Parameters: toolId (int) – ID of the tool in question, as passed to AddTool .
Return type: string


GetToolPacking(self)

Returns the value used for packing tools.

Return type: int

See also

SetToolPacking


GetToolPos(selftoolId)

Returns the tool position in the toolbar, or NOT_FOUND if the tool is not found.

Parameters: toolId (int) – ID of the tool in question, as passed to AddTool .
Return type: int


GetToolSeparation(self)

Returns the default separator size.

Return type: int


GetToolShortHelp(selftoolId)

Returns the short help for the given tool.

Parameters: toolId (int) – ID of the tool in question, as passed to AddTool .
Return type: string


GetToolSize(self)

Returns the size of a whole button, which is usually larger than a tool bitmap because of added 3D effects.

Return type: wx.Size


GetToolState(selftoolId)

Gets the on/off state of a toggle tool.

Parameters: toolId (int) – ID of the tool in question, as passed to AddTool .
Return type: bool
Returns: True if the tool is toggled on, False otherwise.

See also

ToggleTool


GetToolsCount(self)

Returns the number of tools in the toolbar.

Return type: int


InsertControl(selfposcontrollabel="")

Inserts the control into the toolbar at the given position.

You must call Realize for the change to take place.

Parameters:
  • pos (int) –
  • control (wx.Control) –
  • label (string) –
Return type:

wx.ToolBarToolBase

See also

AddControl , InsertTool


InsertLabelTool(selfposidlabelbitmapbmpDisabled=wx.NullBitmapkind=wx.ITEM_NORMALshortHelp=""longHelp=""clientData=None)

Old style method to insert a tool in the toolbar.

Deprecated since version 3.0.3: Use InsertTool instead.


InsertSeparator(selfpos)

Inserts the separator into the toolbar at the given position.

You must call Realize for the change to take place.

Parameters: pos (int) –
Return type: wx.ToolBarToolBase

See also

AddSeparator , InsertTool


InsertSimpleTool(selfpostoolIdbitmapshortHelpString=""longHelpString=""isToggle=0)

Old style method to insert a tool in the toolbar.

Deprecated since version 3.0.3: Use InsertTool instead.


InsertStretchableSpace(selfpos)

Inserts a stretchable space at the given position.

See AddStretchableSpace for details about stretchable spaces.

Parameters: pos (int) –
Return type: wx.ToolBarToolBase

New in version 2.9.1.


InsertTool(self*args**kw)

Inserts the tool with the specified attributes into the toolbar at the given position.

You must call Realize for the change to take place.

Returns: The newly inserted tool or None on failure. Notice that with the overload taking tool parameter the caller is responsible for deleting the tool in the latter case.

 Overloaded Implementations:


InsertTool (self, pos, toolId, label, bitmap, bmpDisabled=NullBitmap, kind=ITEM_NORMAL, shortHelp=””, longHelp=””, clientData=None)

Parameters:
  • pos (int) –
  • toolId (int) –
  • label (string) –
  • bitmap (wx.Bitmap) –
  • bmpDisabled (wx.Bitmap) –
  • kind (ItemKind) –
  • shortHelp (string) –
  • longHelp (string) –
  • clientData (PyUserData) –
Return type:

wx.ToolBarToolBase


InsertTool (self, pos, tool)

Parameters:
Return type:

wx.ToolBarToolBase



Realize(self)

This function should be called after you have added tools.

Return type: bool


RemoveTool(selfid)

Removes the given tool from the toolbar but doesn’t delete it.

This allows to insert/add this tool back to this (or another) toolbar later.

Parameters: id (int) –
Return type: wx.ToolBarToolBase

Note

It is unnecessary to call Realize for the change to take place, it will happen immediately.

See also

DeleteTool


SetDropdownMenu(selfidmenu)

Sets the dropdown menu for the tool given by its id.

The tool itself will delete the menu when it’s no longer needed. Only supported under GTK+ und MSW.

If you define a EVT_TOOL_DROPDOWN() handler in your program, you must call wx.Event.Skip from it or the menu won’t be displayed.

Parameters:
Return type:

bool


SetMargins(self*args**kw)

 Overloaded Implementations:


SetMargins (self, x, y)

Set the values to be used as margins for the toolbar.

Parameters:
  • x (int) – Left margin, right margin and inter-tool separation value.
  • y (int) – Top margin, bottom margin and inter-tool separation value.

Note

This must be called before the tools are added if absolute positioning is to be used, and the default (zero-size) margins are to be overridden.

See also

GetMargins


SetMargins (self, size)

Set the margins for the toolbar.

Parameters: size (wx.Size) – Margin size.

Note

This must be called before the tools are added if absolute positioning is to be used, and the default (zero-size) margins are to be overridden.

See also

GetMargins , wx.Size



SetToolBitmapSize(selfsize)

Sets the default size of each tool bitmap.

The default bitmap size is 16 by 15 pixels.

Parameters: size (wx.Size) – The size of the bitmaps in the toolbar.

Note

This should be called to tell the toolbar what the tool bitmap size is. Call it before you add tools.


SetToolClientData(selfidclientData)

Sets the client data associated with the tool.

Parameters:
  • id (int) – ID of the tool in question, as passed to AddTool .
  • clientData (PyUserData) – The client data to use.


SetToolDisabledBitmap(selfidbitmap)

Sets the bitmap to be used by the tool with the given ID when the tool is in a disabled state.

This can only be used on Button tools, not controls.

Parameters:
  • id (int) – ID of the tool in question, as passed to AddTool .
  • bitmap (wx.Bitmap) – Bitmap to use for disabled tools.

Note

The native toolbar classes on the main platforms all synthesize the disabled bitmap from the normal bitmap, so this function will have no effect on those platforms.


SetToolLongHelp(selftoolIdhelpString)

Sets the long help for the given tool.

Parameters:
  • toolId (int) – ID of the tool in question, as passed to AddTool .
  • helpString (string) – A string for the long help.

Note

You might use the long help for displaying the tool purpose on the status line.


SetToolNormalBitmap(selfidbitmap)

Sets the bitmap to be used by the tool with the given ID.

This can only be used on Button tools, not controls.

Parameters:
  • id (int) – ID of the tool in question, as passed to AddTool .
  • bitmap (wx.Bitmap) – Bitmap to use for normals tools.


SetToolPacking(selfpacking)

Sets the value used for spacing tools.

The default value is 1.

Parameters: packing (int) – The value for packing.

Note

The packing is used for spacing in the vertical direction if the toolbar is horizontal, and for spacing in the horizontal direction if the toolbar is vertical.

See also

GetToolPacking


SetToolSeparation(selfseparation)

Sets the default separator size.

The default value is 5.

Parameters: separation (int) – The separator size.

See also

AddSeparator


SetToolShortHelp(selftoolIdhelpString)

Sets the short help for the given tool.

Parameters:
  • toolId (int) – ID of the tool in question, as passed to AddTool .
  • helpString (string) – The string for the short help.

Note

An application might use short help for identifying the tool purpose in a tooltip.


ToggleTool(selftoolIdtoggle)

Toggles a tool on or off.

This does not cause any event to get emitted.

Parameters:
  • toolId (int) – ID of the tool in question, as passed to AddTool .
  • toggle (bool) – If True, toggles the tool on, otherwise toggles it off.

Note

Only applies to a tool that has been specified as a toggle tool.

Properties


Margins

See GetMargins and SetMargins


ToolBitmapSize

See GetToolBitmapSize and SetToolBitmapSize


ToolPacking

See GetToolPacking and SetToolPacking


ToolSeparation

See GetToolSeparation and SetToolSeparation


ToolSize

See GetToolSize


ToolsCount

See GetToolsCount

wx.ToolBar的更多相关文章

  1. wx

    wx The classes in this module are the most commonly used classes for wxPython, which is why they hav ...

  2. wx.Frame

    wx.Frame A frame is a window whose size and position can (usually) be changed by the user. It usuall ...

  3. wx.BookCtrlBase

    wx.BookCtrlBase A book control is a convenient way of displaying multiple pages of information, disp ...

  4. wxpython wx.windows的API

    wx.Window is the base class for all windows and represents any visible object on screen. All control ...

  5. Python体验(08)-图形界面之工具栏和状态栏

    # coding=utf-8 import wx # 导入必须的Python包 class MenuForm(wx.Frame): def OnQuit(self,event): self.Close ...

  6. wxPython中文教程入门实例

    这篇文章主要为大家分享下python编程中有关wxPython的中文教程,分享一些wxPython入门实例,有需要的朋友参考下     wxPython中文教程入门实例 wx.Window 是一个基类 ...

  7. wxPython学习笔记(初识)

    今天正式开始学习wxPython,基于对类的不熟悉,理解有点生硬,但还是做了些笔记. 1.是什么组成了一个wxpython程序? 一个wxpython程序必须有一个application(wx.App ...

  8. wxPython Major类

    转载自:http://www.yiibai.com/wxpython/wxpython_major_classes.html   原始的 wxWidgets(用C++编写)是一个巨大的类库.GUI类从 ...

  9. wxPython中菜单、按钮学习

    ---恢复内容开始--- wx.Window 是一个基类,许多构件从它继承.包括 wx.Frame 构件.技术上这意味着,我们可以在所有的 子类中使用 wx.Window 的方法.我们这里介绍它的几种 ...

随机推荐

  1. JAVA中synchronized和lock详解

         目前在Java中存在两种锁机制:synchronized和Lock,Lock接口及其实现类是JDK5增加的内容,其作者是大名鼎鼎的并发专家Doug Lea.本文并不比较synchronize ...

  2. Dispatcher.BeginInvoke()方法使用不当导致UI界面卡死的原因分析

    原文:Dispatcher.BeginInvoke()方法使用不当导致UI界面卡死的原因分析 前段时间,公司同事开发了一个小工具,在工具执行过程中,UI界面一直处于卡死状态. 通过阅读代码发现,主要是 ...

  3. mfc窗口,父窗口parentwindow,所有者窗口ownerwindow 区别

    一. parent:创建者,owner:所有者 小玉的父母生下小玉,养到8岁,卖给贾府当丫头小玉的父母是parent,贾府是owner 二. 1.Pop-up窗口: 一个弹出窗口是必须具有WS_POP ...

  4. OpenStack cloudCompute glassary术语project,tenant,user

    1,tenantA group of users, used to isolate access to Compute resources(一组用户,用于隔离访问计算资源). An alternati ...

  5. Redmine backlogs 安装

    之前我们一直用IceScrum的免费版本来运作Scrum项目,用GitLab来做做Issue管理,但是出现了一些问题.GitLab的issue不够好用,不能满足我们的需求,同时issue没有办法放在S ...

  6. java PriorityBlockingQueue 基于优先级队列,的读出操作可以阻止.

    java PriorityBlockingQueue 基于优先级队列.的读出操作可以阻止. package org.rui.thread.newc; import java.util.ArrayLis ...

  7. HTML5实战与剖析之classList属性

    classList属性究竟是干什么的,我们先撇下classList不管.我们考虑这么一个问题,那就是我们如何将拥有多个类名的元素中的其中一个类名删除呢?梦龙较劲脑汁儿终于想到一个实现的方法.将拥有类名 ...

  8. JAVA Socket获取服务端信息

    1.Socket.getInetAddress(),获取服务端地址. 2.Socket.getPort(),获取服务端端口.

  9. UVA 10954 Add All

    题意: 给出n个数,要将n个数相加,每次相加所得的值为当次的计算量,完成所有的求和运算后,要求总的计算量最小. 分析: 直接一个优先队列,由小到大排序,每次前两个相加就好. 代码: #include ...

  10. UVA 1601 The Morning after Halloween

    题意: 给出一个最大为16×16的迷宫图和至多3个ghost的起始位置和目标位置,求最少经过几轮移动可以使三个ghost都到达目标位置.每轮移动中,每个ghost可以走一步,也可以原地不动,需要注意的 ...