Skip to content
Related Articles

Related Articles

wxPython – Frame() Constructor in Python

Improve Article
Save Article
Like Article
  • Last Updated : 21 Oct, 2021

In this article we will know about the frame() constructor in wxPython. frame() constructor is a constructor for the wx.Frame class of wxPython. This constructor is used to set different attributes of the frame.
 

Syntax : 
 

wx.Frame(parent, id=ID_ANY, title="", pos=DefaultPosition,
         size=DefaultSize, style=DEFAULT_FRAME_STYLE, name=FrameNameStr)

Parameters : 

 

ParameterInput TypeDescription
parentwx.WindowParent window. Should not be None.
idwx.WindowIDControl identifier. A value of -1 denotes a default value.
titlestringTitle to the frame.
poswx.PointWindow position.
sizewx.WindowWindow size.
stylelongWindow style.
namestringWindow name.

 

Code: 
 

Python3




# import wxPython
import wx
 
app = wx.App()
 
# create frame using Frame() constructor
frame = wx.Frame(None, id = 10, title ="Frame",
                      pos = wx.DefaultPosition,
                         size = wx.DefaultSize,
                style = wx.DEFAULT_FRAME_STYLE,
                               name = "frame")
 
# show frame
frame.Show(True)
 
app.MainLoop()

Output: 
 

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!