
- wxPython Tutorial
- wxPython - Home
- wxPython - Introduction
- wxPython - Environment
- wxPython - Hello World
- wxPython - GUI Builder Tools
- wxPython - Major Classes
- wxPython - Event Handling
- wxPython - Layout Management
- wxPython - Buttons
- wxPython - Dockable Windows
- Multiple Document Interface
- wxPython - Drawing API
- wxPython - Drag and Drop
- wxPython Resources
- wxPython - Quick Guide
- wxPython - Useful Resources
- wxPython - Discussion
wxPython - Frame Class
wx.Frame Class has a default constructor with no arguments. It also has an overloaded constructor with the following parameters −
Wx.Frame (parent, id, title, pos, size, style, name)
S.N. | Parameters & Description |
---|---|
1 | Parent Window parent. If None is selected the object is at the top level window. If None is not selected, the frame appears on top of the parent window |
2 | id Window identifier. Usually -1 to let the identifier be generated automatically |
3 | Title Caption to appear in the title bar |
4 | Pos The starting position of the frame. If not given, wxDefaultPosition is as decided by OS |
5 | Size Dimensions of the window. wxDefaultSize is decided by OS |
6 | style Appearance of the window controlled by style constants |
7 | name The internal name of object |
Window Style Constants
wx.DEFAULT_FRAME_STYLE |
wx.CAPTION |
wx.MINIMIZE_BOX |
wx.MAXIMIZE_BOX |
wx.CLOSE_BOX |
wx.SYSTEM_MENU |
wx.RESIZE_BORDER |
wx.STAY_ON_TOP |
wx.FRAME_FLOAT_ON_PARENT |
wx.DEFAULT_FRAME_STYLE is defined as −
- wx.MINIMIZE_BOX
- wx.MAXIMIZE_BOX
- wx.RESIZE_BORDER
- wx.SYSTEM_MENU
- wx.CAPTION
- wx.CLOSE_BOX
- wx.CLIP_CHILDREN
Example
window = wx.Frame(None, -1, Hello, pos = (10,10), size = (300,200), style = wxDEFAULT_FRAME_STYLE, name = "frame")
wx.Frame Class Member Functions
S.N. | Functions & Description |
---|---|
1 | CreateStatusBar() Creates the status bar at bottom of the window |
2 | CreateToolBar() Creates the toolbar at the top or left of the window |
3 | GetMenuBar() Gets reference to menu bar |
4 | GetStatusBar() Gets reference to statusbar |
5 | SetMenuBar() Displays the menu bar object in the frame |
6 | setStatusBar() Associates the status bar object to the frame |
7 | SetToolBar() Associates a toolbar object to the frame |
8 | SetStatusText() Displays text on the status bar |
9 | Create() Creates a frame with provided parameters |
10 | Centre() Places the frame at the center of display |
11 | SetPosition() Places the frame at given screen coordinates |
12 | SetSize() Resizes the frame to given dimensions |
13 | SetTitle() Inserts the given text in the title bar |
wx.Frame event binders
S.N. | Events & Description |
---|---|
1 | EVT_CLOSE When the frame is being closed by the user clicking the close button or programmatically |
2 | EVT_MENU_OPEN When a menu is about to be opened |
3 | EVT_MENU_CLOSE When a menu has just been closed |
4 | EVT_MENU_HIGHLIGHT When the menu item with the specified id has been highlighted |