== Introduction == As of this writing, the current wxWidgets API does not supply an interface to enumerate the tools in a toolbar if the tool IDs are not known in advance. A [[http://trac.wxwidgets.org/ticket/11628|ticket suggesting this feature]] has been posted in the tracker. In the meantime, this recipe describes techniques that attempt to elicit this information using the existing APIs. == A Simple Approach for a Simple Toolbar == If you have a simple horizontal tool bar with exactly one row and evenly-spaced tools and no spacers, the following code snippet appears to work to retrieve the tools. {{{ #!python def getToolsForToolbar(tb): tool_size = tb.GetToolSize() width, height = tool_size pos = 0 while True: tool = tb.FindToolForPosition(pos, 0) if tool: yield tool else: break pos += width }}} If you end up building on this to handle some of the aforementioned limitations, please consider updating this Wiki.