[Tutor] open-file GUI

FT chester_lab at fltg.net
Fri Jul 4 19:59:10 CEST 2008

    My demo is from wspython.

I am starting to use Python+NumPy+SciPy+Matplotlib as a substitute to MATLAB.

I need a simple GUI that can help me to open files and save file i.e. something similar to uigetfile in MATLAB.
Is there a simple script that opens a window with a possibility to browse through the file system and pick an ASCII file ?
After the file is spcified using the GUI, I want to read it using fromfile and similar commands.
After I process the data I want a similar GUI that enables choosing the path and name for saving the results file.

Are scripts of this type available ?

Eli Brosh

This method allows you to either display the last file name or change the fn to "" for an open command so it does not display the file name. Then fn assignment commented out... 

        self.dirname=os.getcwd()  #SEARCH FROM PRESENT DIRECTORY!

    def setFilePath(self, type4file=""):
        " Search directory for path and file name!"
        t4f = wx.OPEN
        if type4file[0] in "sS":
            t4f = wx.SAVE|wx.FD_OVERWRITE_PROMPT
#            fn = self.filename
        dlg = wx.FileDialog(self, self.filename +" or Choose a file",
self.dirname, fn, "*.*", t4f)
        if dlg.ShowModal() == wx.ID_OK:
            self.filename = dlg.GetFilename()
            self.dirname = dlg.GetDirectory()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080704/0712c339/attachment.htm>

More information about the Tutor mailing list