Python
  Home arrow Python arrow Page 4 - Alternative Frames in wxPython
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
Moblin 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Alternative Frames in wxPython
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2005-08-29

    Table of Contents:
  • Alternative Frames in wxPython
  • wxDialog
  • wxWizard
  • Multiple Document Interface

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    Alternative Frames in wxPython - Multiple Document Interface


    (Page 4 of 4 )

    Microsoft's Multiple Document Interface, or MDI, allows a parent window to house multiple child windows. The wxPython library supports the Multiple Document Interface, and it is simple to include it in your applications:

    from wxPython.wx import *

    # Subclass wxMDIParentFrame

    class Parent ( wxMDIParentFrame ):

       def __init__ ( self ):

          # Call __init__ and make the window big

          wxMDIParentFrame.__init__ ( self, None, -1, "Multiple Document Interface Test", size = ( 500, 500 ) )

          # Create a menu that allows us to open new windows

          windowMenu = wxMenu()

          windowMenu.Append ( 1, 'Open New' )

          # Create a menu bar and add the menu

          menuBar = wxMenuBar()

          menuBar.Append ( windowMenu, 'Options' )

          self.SetMenuBar ( menuBar )

          # Catch a menu click

          EVT_MENU ( self, 1, self.openNew )

          self.Show ( True )

       # This method will add a window

       def openNew ( self, event ):

          # Create a child window

          child = wxMDIChildFrame ( self, -1, 'MDI Child' )

          # Give the child a panel

          child.panel = wxPanel ( child, -1 )

          child.panel.SetSize ( child.GetClientSize() )

          # Add a label

          child.label = wxStaticText ( child, -1, 'I am only a child.' )

          child.Show ( True )

    application = wxPySimpleApp()

    Parent()

    application.MainLoop()

    Although the idea sounds complicated at first, wxPython makes it all extremely easy, requiring only a handful of code to create something basic like we did. Notice, too, that a “Window” menu is added to our application, giving us organization and navigation options.

    The Multiple Document Interface is useful in some applications. Each window has the potential to be very different from the next window, too. It's all up to your creativity.

    Conclusion

    The wxPython library offers more frames than just wxFrame. These frames are geared toward specific things, such as modal dialogs, modeless dialogs, wizards and organizing child windows within a large parent window. They enable you to extend your application's capabilities with little effort, and, at the same time, give you a variety of complex options. They can be excellent additions to your applications, benefitting the end user and, in turn, you –- the developer.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hey, all. This article just presents some new canvases to work with. Before you read...
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway