Alternative Frames in wxPython (Page 1 of 4 )
I'm sure you know all about wxPython's primary frame, wxFrame. It is the basis for most of your windows and will most likely continue to be. Of course, though, wxPython offers other things to put controls on. I'm sure you're getting bored of attaching your controls to slight variations of the same exact thing. In this article, we'll explore other frames offered by
wxPython, examining what they are for, how they are used and how to change their appearance.
Let's get started.
wxMiniFrame
Our first stop is wxMiniFrame. It is basically a frame with a short title bar at the top, rather than the large one that wxFrame displays. While entire applications will definitely look strange in a wxMiniFrame, small windows that must stay out of the user's way can be made with wxMiniFrame. Let's take a look:
from wxPython.wx import *
class Window ( wxMiniFrame ):
def __init__ ( self ):
# No suprises here
# We only use a different class
wxMiniFrame.__init__ ( self, None, -1, 'A Small Frame' )
# Create a panel
self.panel = wxPanel ( self, -1 )
# Create a wxCheckBox
self.check = wxCheckBox ( self.panel, -1, 'This is a wxMiniFrame', pos = ( 10, 10 ) )
# No suprises here, either
self.Show ( True )
application = wxPySimpleApp()
Window()
application.MainLoop()
The wxMiniFrame class features nothing else worth mentioning. It's nothing more than a small frame. Let's move on to something else.
Next: wxDialog >>
More Python Articles
More By Peyton McCullough