Reputation: 705
is it possible to hide (and later show) an element in a toolbar?
toolbar = self.CreateToolBar()
element = toolbar.AddLabelTool(wx.ID_ANY, 'Hi', wx.Bitmap('hello.png'))
toolbar.Realize()
Using element.Hide() returns an error,
Thanks for any support
Upvotes: 1
Views: 1272
Reputation: 1022
Tools can be removed from the tool bar. They can then be added back later. Unfortunately, there is no simple hide function that I can find.
https://wxpython.org/Phoenix/docs/html/wx.ToolBar.html#wx.ToolBar.RemoveTool
Upvotes: 0
Reputation: 33071
I don't think the wx.Toolbar supports hiding individual items. However, the FlatMenu seems to: http://www.wxpython.org/docs/api/wx.lib.agw.flatmenu-module.html I would recommend giving that a try.
Upvotes: 2
Reputation: 51
You can disable tool:
toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.NO_BORDER)
toolbar.AddSimpleTool(1, wx.Image('stock_new.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap(), 'New', '')
toolbar.EnableTool(1,False)
or you can just insert tool when you want to do this
Upvotes: 1