Python Wxpython Remove Title

■ Most user interaction in a wxPython program takes place inside either a wx.Frame or a wx.Dialog. The wx.Frame class represents what a user would typically call a window. Instances of wx.Frame are created in much the same way as other wxPython widgets. A typical usage of wx.Frame involves creating a subclass which extends the base class, usually by defining subwidgets, layout, and behavior. Usually, a frame contains a single top level subwidget of type wx.Panel or some other container window.

■ There are a variety of style flags specific to wx.Frame. Some of these flags affect the size and shape of the frame, others affect how it is drawn relative to other frames in the system, and others define what interface decorators are on the frame border. In some cases, a two-stage creation process is needed to define a style flag.

■ A request can be made to close a frame by calling the Close() method. This gives the frame an opportunity to close any resources it might be holding. The frame can also veto a close request. Calling the Destroy() method forces a frame to go away without reprieve.

■ A specific subwidget inside a frame can be found using its wxPython ID, its name, or its text label.

■ Scrolling is managed by including a container widget of type wx.Scrolled-Window. There are several ways to set the scrolling parameters, the easiest is to use a sizer inside the scrolled window, in which case wxPython automatically determines the virtual size of the scroll panel. However, the virtual size can be set manually if desired.

■ There are a couple of different frame subclasses that allow for different looks. The class wx.MDiParentFrame can be used to create an MDI, while a wx.Mini-Frame can create a toolbox-style window with a smaller title bar. Frames can be made to appear non-rectangular using the SetShape() method. The region can be defined by any bitmap, with a simple color mask to determine the edge of the region. Non-rectangular windows are usually without the normal title bar allowing the frame to be dragged, but that can be managed by explicitly handling mouse events.

■ A draggable sash between two sub-windows can be implemented using wx.SplitterWindow, which can be manipulated interactively by the user or programmatically if needed.

In the next chapter, we'll discuss dialog boxes, which behave similarly to frames.

Was this article helpful?

0 0


  • Alfrida
    How to create window with non titlebar wxpython?
    8 years ago

Post a comment