wxPython Multiple Document Interface - wxPython

What is the use of wxPython Multiple Document Interface?

A classic GUI application can have multiple windows. Tabbed and stacked widgets help in activating one such window at a time. This approach may not be useful most of the times as view of other windows will be hidden.

One way of displaying multiple windows concurrently is to create them as independent windows and this is known as SDI (Single Document Interface). This needs more memory resources as each window may have its own menu system, toolbar, etc.

MDI framework in wxPython provides a wx.MDIParentFrame class and its object will act as a container for multiple child windows, each an object of wx.MDIChildFrame class.

Child windows will be located in the MDIClientWindow area of the parent frame. As soon as a child frame is added, menu bar of the parent frame will display a Window menu which consists of buttons to arrange the children in a cascaded or tiled manner.

Example

Below example explains the uses of MDIParentFrame as top level window. A Menu button called NewWindow will add a child window in the client area. Multiple windows can be added and then arranged in a cascaded or tiled order.

Complete code is as follows

Above code produces the following output

mdi_output.jpg

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

wxPython Topics