Saturday, May 16, 2026
HomeLanguagesPython – Statusbar in wxPython

Python – Statusbar in wxPython

In this article we are going to learn how can we add a status bar to wxPython frame. We can create status bar in frame using CreateStatusBar() function present in wx.Frame class. By default it has white background and dark gray text color.

Syntax:

wx.Frame.CreateStatusBar(self, number=1, style=STB_DEFAULT_STYLE,
                                     id=0, name=StatusBarNameStr)

Parameters :

Parameter Input Type Description
parent wx.Window Parent window. Should not be None.
number int The number of fields to create. Specify a value greater than 1 to create a multi-field status bar.
style long The status bar style.
id wx.WindowID The status bar window identifier. If -1, an identifier will be chosen by wxWidgets.
name string The status bar window name.

Code Example : 

Python3




# import wxython
import wx
 
 
class Example(wx.Frame):
 
    def __init__(self, *args, **kw):
        super(Example, self).__init__(*args, **kw)
        self.InitUI()
 
    def InitUI(self):
        # create status bar
        self.statusBar = self.CreateStatusBar(style = wx.BORDER_NONE)
        # set text to status bar
        self.statusBar.SetStatusText("Status Bar")
 
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
 
 
if __name__ == '__main__':
    main() 


Output :

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

5 COMMENTS

Most Popular

Dominic
32514 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6892 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12107 POSTS0 COMMENTS
Shaida Kate Naidoo
7016 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6975 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS