wxPython – Show hidden toolbar in the frame

In this article, we will learn how can we show a hidden Toolbar. In order to unhide/show a Toolbar we can use Show() function. Show() function can be used to do both shows as well as hide the Toolbar. Show() function takes show boolean parameter which, If True displays the window. Otherwise, hides it.

Syntax: wx.ToolBar.Show(self, show=True)


Parameter Input Type Description
show bool If True displays the window. Otherwise, hides it.

Return Type: bool

Returns: True if the window has been shown or hidden or False if nothing was done because it already was in the requested state.

Code Example:





import wx
class Example(wx.Frame):
    global count
    count = 0;
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        self.toolbar = self.CreateToolBar()
        tool = self.toolbar.AddTool(wx.ID_ANY, 'First'
        # panel for button
        self.pnl = wx.Panel(self)
        # button to hide toolbar
        self.btn = wx.Button(self.pnl, label ='Hide Toolbar', pos =(20, 20))
        # button to show toolbar
        self.btn2 = wx.Button(self.pnl, label ='Show Toolbar', pos =(200, 20))
        # bind event with hide button
        self.btn.Bind(wx.EVT_BUTTON, self.onclickhide)
        # bind event with show button
        self.btn2.Bind(wx.EVT_BUTTON, self.onclickshow)
        self.SetSize((350, 250))
        self.SetTitle('Simple toolbar')
    def onclickhide(self, e):
        # hide toolbar
    def onclickshow(self, e):
        # hide toolbar
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':


Output Window:

before clickin button

after clicking button

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

Hi there I am a student of CGC COE, Landran in CSE department and have a great interest in programming

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.