This is an archival dump of old wiki content --- see for current material.
Please see


Something I enjoy in matlab is the ease in which simple file selector dialogs, and status bars can be made. Now that I use nothing but scipy, I have wanted to have simliar functions for my scipy code. Thanks to the great reference "wxPython in Action" I have learned some of the basics again, with the promise of making very fancy GUIs if I ever find the urge! (Check out the sample chapters, they have given the entire section on making dialogs, which is how I initially got started with wxPython).

File Selector Dialog

I often write simple translation scripts that convert some data, into another form. I like to use these for a series of data, and share them with some coworkers who do not program. the wxPython FileSelector function comes to the rescue.

   1 import wx
   3 # setup the GUI main loop
   4 app = wx.App()
   6 filename = wx.FileSelector()

With this basic code, filename contains a string pathname (may be unicode depending on your installation of wxPython, more on this latter) of the selected file.

Some of the spiffing up will include using the current directory the script was started in, we do this easily

   1 import wx
   2 import os
   4 # setup the GUI main loop
   5 app = wx.App()
   7 filename = wx.FileSelector(default_path=os.getcwd())

If one runs such script repeatedly, it might be a good idea to do some basic clean-up after each run.

   1 # ...
   2 app.Destroy()

To be continued . . .

Status Bar

Coming soon . . .

SciPy: Cookbook/wxPython_dialogs (last edited 2015-10-24 17:48:25 by anonymous)