Module wx.aui
The wx.aui moduleis an Advanced User Interface library that aims to
implement "cutting-edge" interface usability and design features so
developers can quickly and easily create beautiful and usable
application interfaces.
Vision and Design Principles
wx.aui attempts to encapsulate the following aspects of the user
interface:
- Frame Management: Frame management provides the means to open,
move and hide common controls that are needed to interact with the
document, and allow these configurations to be saved into
different perspectives and loaded at a later time.
- Toolbars: Toolbars are a specialized subset of the frame
management system and should behave similarly to other docked
components. However, they also require additional functionality,
such as "spring-loaded" rebar support, "chevron" buttons and
end-user customizability.
- Modeless Controls: Modeless controls expose a tool palette or set
of options that float above the application content while allowing
it to be accessed. Usually accessed by the toolbar, these controls
disappear when an option is selected, but may also be "torn off"
the toolbar into a floating frame of their own.
- Look and Feel: Look and feel encompasses the way controls are
drawn, both when shown statically as well as when they are being
moved. This aspect of user interface design incorporates "special
effects" such as transparent window dragging as well as frame
animation.
wx.aui adheres to the following principles
- Use native floating frames to obtain a native look and feel for
all platforms;
- Use existing wxPython code where possible, such as sizer
implementation for frame management;
- Use standard wxPython coding conventions.
Usage
The following example shows a simple implementation that utilizes
wx.aui.FrameManager
to manage three text controls in a frame window:
import wx
import wx.aui
class MyFrame(wx.Frame):
def __init__(self, parent, id=-1, title='wx.aui Test',
size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self._mgr = wx.aui.AuiManager(self)
# create several text controls
text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text',
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
text2 = wx.TextCtrl(self, -1, 'Pane 2 - sample text',
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
text3 = wx.TextCtrl(self, -1, 'Main content window',
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
# add the panes to the manager
self._mgr.AddPane(text1, wx.LEFT, 'Pane Number One')
self._mgr.AddPane(text2, wx.BOTTOM, 'Pane Number Two')
self._mgr.AddPane(text3, wx.CENTER)
# tell the manager to 'commit' all the changes just made
self._mgr.Update()
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, event):
# deinitialize the frame manager
self._mgr.UnInit()
# delete the frame
self.Destroy()
app = wx.App()
frame = MyFrame(None)
frame.Show()
app.MainLoop()
Function Summary |
AuiMDIChildFrame |
PreAuiMDIChildFrame()
|
AuiMDIClientWindow |
PreAuiMDIClientWindow()
|
AuiMDIParentFrame |
PreAuiMDIParentFrame()
|
AuiNotebook |
PreAuiNotebook()
|