Open In App
Related Articles

wxPython – Create() function in wx.StaticText

Improve Article
Save Article
Like Article

In this article we are going to learn about Create() associated with wx.StaticText class of wxPython. A static text control displays one or more lines of read-only text. Create() function is used for two step creation of static text. It takes attributes of statictext as arguments.

Syntax: wx.StaticText.Create(parent, id=ID_ANY, label=””, pos=DefaultPosition, size=DefaultSize, style=0, name=StaticTextNameStr) Parameters:

Parameter Input Type Description
parent wx.Window Parent window. Should not be None.
id wx.Window Parent window. Should not be None.
parent wx.WindowID Control identifier. A value of -1 denotes a default value.
label string Text label.
pos wx.Point Window position.
size wx.Size Window size.
style long Window style.
name string Window name.

Return Type: bool

Code Example: 


import wx
class Example(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(Example, self).__init__(*args, **kwargs)
    def InitUI(self):
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        self.pnl = wx.Panel(self)
        bmp = wx.Bitmap('right.png')
         = wx.StaticText()
        # CREATE STATICTEXT AT POINT (20, 20) USING Create() FUNCTION, id = 1, label ="This is StaticText", pos =(20, 20),
                                size = wx.DefaultSize, style = 0, name ="statictext")
        self.SetSize((350, 250))
def main():
    app = wx.App()
    ex = Example(None)
if __name__ == '__main__':

Output Window:

Last Updated : 01 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials