Open In App

wxPython – Frame() Constructor in Python

Last Updated : 21 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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 : 

 

Parameter Input Type Description
parent wx.Window Parent window. Should not be None.
id wx.WindowID Control identifier. A value of -1 denotes a default value.
title string Title to the frame.
pos wx.Point Window position.
size wx.Window Window size.
style long Window style.
name string Window 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: 
 

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads