Sunday, October 6, 2024
Google search engine
HomeLanguageswxPython – SetStatusStyles() function in wx.StatusBar

wxPython – SetStatusStyles() function in wx.StatusBar

In this article e are going to learn about SetStatusStyles() function associated with wx.StatusBar class of wxPython. SetStatusStyles() function Sets the styles of the fields in the status line which can make fields appear flat or raised instead of the standard sunken 3D border.
It takes an array of n integers with the styles for each field as an argument.
 

Syntax: wx.StatusBar.SetStatusStyles(Self, styles)
Parameters: 
 

Parameter Input Type Description
styles list of int Contains an array of n integers with the styles for each field.

There are four possible styles:
1. SB_NORMAL (default): The field appears with the default native border.
2. SB_FLAT: No border is painted around the field so that it appears flat.
3. SB_RAISED: A raised 3D border is painted around the field.
4. SB_SUNKEN: A sunken 3D border is painted around the field (this style is new since wxWidgets 2.9.5).
 

Code Example: 

Python3




import wx
 
 
class Example(wx.Frame):
 
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
 
        self.InitUI()
 
    def InitUI(self):
 
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        self.statusbar = wx.StatusBar()
        self.statusbar.Create(self, id = 1, name = "Status Bar")
        self.SetStatusBar(self.statusbar)
        self.SetSize((350, 250))
 
        # SET TOTAL NUMBER OF FIELDS AND RESPECTIVE WIDTHS
        self.statusbar.SetFieldsCount(3, [100, 80, 60])
 
        # SET TEXT FOR ALL FIELDS
        self.statusbar.SetStatusText("Field One", 0)
        self.statusbar.SetStatusText("Field Two", 1)
        self.statusbar.SetStatusText("Field Three", 2)
        self.statusbar.SetBackgroundColour((200, 188, 73, 243))
 
        # SET STYLES FOR ALL STATUS FIELDS
        self.statusbar.SetStatusStyles([wx.SB_FLAT, wx.SB_SUNKEN, wx.SB_RAISED])
        self.SetTitle('New Frame Title')
        self.Centre()
        print(self.statusbar.GetMinHeight())
 
 
def main():
    app = wx.App()
    ex = Example(None)
    ex.Show()
    app.MainLoop()
 
 
if __name__ == '__main__':
    main()


Output Window: 

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

Most Popular

Recent Comments