Python
  Home arrow Python arrow Page 4 - Dialogs 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 
Moblin 
JMSL Numerical Library 
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

Dialogs in wxPython
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 13
    2005-08-01

    Table of Contents:
  • Dialogs in wxPython
  • wxScrolledMessageDialog
  • wxProgressDialog
  • ImageDialog
  • wxDirDialog
  • wxFileDialog

  • 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


    Dialogs in wxPython - ImageDialog


    (Page 4 of 6 )

    The ImageDialog is a very nice dialog. It displays the images in a given directory. It's very simple to use:

    from wxPython.wx import *

    # Import the required module

    from wxPython.lib import imagebrowser

    application = wxPySimpleApp()

    # Create the dialog

    dialog = imagebrowser.ImageDialog ( None )

    # Show the dialog

    dialog.ShowModal()

    # Destroy the dialog

    dialog.Destroy()

    Of course, we'll need to retrieve the file name of the image that the user specifies. This is easily done:

    from wxPython.wx import *

    from wxPython.lib import imagebrowser

    application = wxPySimpleApp()

    dialog = imagebrowser.ImageDialog ( None )

    # Display the file name if the user selected one

    if dialog.ShowModal() == wxID_OK:

       print 'You picked:', dialog.GetFile()

    # Otherwise, yell and scream at the user for cancelling

    else:

       print 'You did not select an image!'

    dialog.Destroy()

    If we need to set a directory other than the current directory, it's possible to do so by passing a second argument:

    from wxPython.wx import *

    from wxPython.lib import imagebrowser

    application = wxPySimpleApp()

    # Specify a directory

    dialog = imagebrowser.ImageDialog ( None, 'C:\' )

    if dialog.ShowModal() == wxID_OK:

       print 'You picked:', dialog.GetFile()

    else:

       print 'You did not select an image!'

    dialog.Destroy()

    More Python Articles
    More By Peyton McCullough


       · goog topic, but it doesn't work well :Traceback (most recent call last): File...
       · We returned to the original article and it seemed that a line of code was missed...
       · Vous avez écrit :dialog = wxScrolledMessageDialog ( self, text, 'Fairy Tale'...
     

       

    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 5 hosted by Hostway