Python wx 模块,FD_SAVE 实例源码

我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用wx.FD_SAVE

项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)

        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)

        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)

        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveMessages(self, event=None):
        """Save the message log to file.
        """
        saveDialog = wx.FileDialog(self.scrolledPanel, message='Save Message Log',
            wildcard='Text Files (*.txt)|*.txt|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            with open(saveDialog.GetPath(), 'w') as fileHandle:
                fileHandle.write(self.messageArea.GetValue())
        except Exception as e:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def stopRecording(self):
        if self.recordingTime is not None:
            secsToSave = time.time() - self.recordingTime

            wx.LogMessage('Page %s saving %f secs of EEG' % (self.name, secsToSave))

            cap = self.src.getEEGSecs(secsToSave, filter=False)

            saveDialog = wx.FileDialog(self, message='Save EEG data.',
                wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
                style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

            try:
                if saveDialog.ShowModal() != wx.ID_CANCEL:
                    cap.saveFile(saveDialog.GetPath())
            except Exception as e:
                wx.LogError('Save failed!')
                raise
            finally:
                saveDialog.Destroy()

        self.recordButton.SetLabel('Start Recording')
        self.recordingTime = None
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def getpath(title, filt, k, para=None):
    """Get the defaultpath of the ImagePy"""
    dpath = manager.ConfigManager.get('defaultpath')
    if dpath ==None:
        dpath = root_dir # './'
    dic = {'open':wx.FD_OPEN, 'save':wx.FD_SAVE}
    dialog = wx.FileDialog(curapp, title, dpath, '', filt, dic[k])
    rst = dialog.ShowModal()
    path = None
    if rst == wx.ID_OK:
        path = dialog.GetPath()
        dpath = os.path.split(path)[0]
        manager.ConfigManager.set('defaultpath', dpath)
        if para!=None:para['path'] = path
    dialog.Destroy()

    return rst if para!=None else path
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def on_save_as(self):
        if self.get_project_filename():
            dir_name, file_name = os.path.split(self.get_project_filename())
        style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
        wildcard = "Arquivo de projeto do GRIPy (*.pgg)|*.pgg"
        fdlg = wx.FileDialog(self.GetTopWindow(), 
                             'Escolha o arquivo PGG', 
                            #dir_name, file_name, 
                            wildcard=wildcard, style=style
        )
        if fdlg.ShowModal() == wx.ID_OK:
            file_name = fdlg.GetFilename()
            dir_name = fdlg.GetDirectory()
            if not file_name.endswith('.pgg'):
                file_name += '.pgg'
            disableAll = wx.WindowDisabler()
            wait = wx.BusyInfo("Saving GriPy project. Wait...")    
            self.save_project_data(os.path.join(dir_name, file_name))
            del wait
            del disableAll
        fdlg.Destroy()
项目:nimo    作者:wolfram2012    | 项目源码 | 文件源码
def onSaveAs(self,event):
        fd = wx.FileDialog(self,message="Save the coordinates as...",style=wx.FD_SAVE,
                           wildcard="Comma separated value (*.csv)|*.csv")
        fd.ShowModal()
        self.filename = fd.GetPath()

        self.save(self.filename)
项目:fritzchecksum    作者:mementum    | 项目源码 | 文件源码
def OnButtonSaveAs(self, msg):
        if not self.model.status:
            wx.MessageBox('No export file has been successfully loaded yet!')
            return

        dialog = wx.FileDialog(
            self, 'Save As ...', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        result = dialog.ShowModal()
        if result != wx.ID_OK:
            return

        # Show filedialog and get value
        self.model.save(dialog.GetPath())
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveResultText(self, resultText):
        saveDialog = wx.FileDialog(self, message='Save Result Text.',
            wildcard='Text (*.txt)|*.txt|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            with open(saveDialog.GetPath(), 'w') as fd:
                fd.write(resultText)
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)
        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()

    ##def decimate(self, cap):
    ##    #cap = cap.demean().bandpass(0.5, 10.0, order=3)
    ##    cap = cap.copy().demean().bandpass(0.5, 12.0, order=3)

    ##    # kind of a hack XXX - idfah
    ##    if cap.getSampRate() > 32.0:
    ##        decimationFactor = int(np.round(cap.getSampRate()/32.0))
    ##        cap = cap.downsample(decimationFactor)

    ##    return cap
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)
        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveResultText(self, resultText):
        saveDialog = wx.FileDialog(self, message='Save Result Text.',
            wildcard='Text (*.txt)|*.txt|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            with open(saveDialog.GetPath(), 'w') as fd:
                fd.write(resultText)
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()

    #def decimate(self, cap):
    #    #cap = cap.demean().bandpass(0.5, 20.0, order=3)

    #    # original
    #    #cap = cap.copy().demean().bandpass(0.5, 12.0, order=3)
    #    # biosemi hack XXX - idfah
    #    cap = cap.copy().demean().reference((36,37)).deleteChans(range(32,40))
    #    cap.keepChans(('Fz', 'Cz', 'P3', 'Pz', 'P4', 'P7', 'Oz', 'P8'))

    #    # kind of a hack XXX - idfah
    #    if cap.getSampRate() > 32.0:
    #        decimationFactor = int(np.round(cap.getSampRate()/32.0))
    #        cap = cap.downsample(decimationFactor)

    #    return cap
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)
        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def OnSave(self,e):
        panelphase = self.GetChildren()[1].GetPage(0)
        if panelphase.pipeline_started == False:
            cwd = self.CurrentWD()
            if IsNotWX4():
                dlg = wx.FileDialog(self, "Choose a file", cwd, "", "fin files (*.fin)|*.fin|All files (*.*)|*.*", wx.SAVE | wx.OVERWRITE_PROMPT)
            else:
                dlg = wx.FileDialog(self, "Choose a file", cwd, "", "fin files (*.fin)|*.fin|All files (*.*)|*.*", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
            if dlg.ShowModal() == wx.ID_OK:
                self.filename=dlg.GetFilename()
                self.dirname=dlg.GetDirectory()
                SaveInstance(self)
            dlg.Destroy()
项目:laplacian-meshes    作者:bmershon    | 项目源码 | 文件源码
def OnSaveMesh(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*", wx.FD_SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetFilename()
            dirname = dlg.GetDirectory()
            filepath = os.path.join(dirname, filename)
            self.glcanvas.mesh.saveFile(filepath, True)
            self.glcanvas.Refresh()
        dlg.Destroy()
        return
项目:laplacian-meshes    作者:bmershon    | 项目源码 | 文件源码
def OnSaveScreenshot(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*", wx.FD_SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetFilename()
            dirname = dlg.GetDirectory()
            filepath = os.path.join(dirname, filename)
            saveImageGL(self.glcanvas, filepath)
        dlg.Destroy()
        return
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def save_dialogue(self, event, defaultFile):
        dlg = wx.FileDialog(self, defaultDir='./', defaultFile=defaultFile,
                            style=wx.FD_SAVE) 
        if (dlg.ShowModal() == wx.ID_OK):
            fpath = dlg.GetPath()
        dlg.Destroy()

        #Check if defined, if cancel pressed then return
        try:
            fpath
        except NameError:
            return

        if defaultFile == 'fig.png':
            try:
                print('Saving figure as ' + fpath)
                self.pyplotp.savefigure(fpath)
                print('Saved.')
            except ValueError:
                raise
        elif defaultFile == 'data.csv':
            print('Writing data as ' + fpath)
            self.pyplotp.writedatacsv(fpath)
            print('Finished.')
        elif defaultFile == 'script.py':
            self.pyplotp.writescript(fpath)

        #Output error as dialogue
        #import sys
        #exc_info = sys.exc_info()
        #print(exc_info, dir(exc_info), type(exc_info))
        #showMessageDlg(exc_info[1])
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def on_save(self, evt):
        dic = {'open':wx.FD_OPEN, 'save':wx.FD_SAVE}
        filt = 'PNG files (*.png)|*.png'
        dialog = wx.FileDialog(self, 'Save Picture', '', '', filt, wx.FD_SAVE)
        rst = dialog.ShowModal()
        if rst == wx.ID_OK:
            path = dialog.GetPath()
            self.canvas.save_bitmap(path)
        dialog.Destroy()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def _OnSave(self,typename="Csv",sep=","):
        dialog=wx.FileDialog(self,typename,style=wx.FD_SAVE)
        if dialog.ShowModal()==wx.ID_OK:
            self.file=dialog.GetPath()
            self.save_tab(self.file, sep)
        dialog.Destroy()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def OnSave(self,event):
        if self.file=='':
            dialog=wx.FileDialog(None,'wxpython Notebook(s)',style=wx.FD_SAVE)
            if dialog.ShowModal()==wx.ID_OK:
                self.file=dialog.GetPath()
                self.text.SaveFile(self.file)
            dialog.Destroy()
        else:
            self.text.SaveFile(self.file)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def OnSaveAs(self,event):
        dialog=wx.FileDialog(None,'wxpython notebook',style=wx.FD_SAVE)
        if dialog.ShowModal()==wx.ID_OK:
            self.file=dialog.GetPath()
            self.text.SaveFile(self.file)
        dialog.Destroy()
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def save(self, e):
        if not hasattr(self, "brackets"):
            errortext = "Make bracket before doing that"
            w = wx.MessageDialog(self.parent, errortext,
                                 "Error", wx.ICON_ERROR)
            w.ShowModal()
            w.Destroy()
            return
        dia = wx.FileDialog(self, "Save Bracket",
                            "", self.sname, "bp5000 bracket|*.bp5",
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dia.ShowModal() == wx.ID_CANCEL:
            return

        bracketio.write_bracket(dia.GetPath(), self.brackets)
项目:py3_project    作者:tjy-cool    | 项目源码 | 文件源码
def save_file(self, event):
        '''??????????? '''
        wildcard = "Text Files (*.txt)|*.txt|" "All files (*.*)|*.*"
        dlg = wx.FileDialog(None, u"???????",
                            os.getcwd(),
                            defaultFile="",
                            style=wx.FD_SAVE,  # |wx.FD_OVERWRITE_PROMPT
                            wildcard=wildcard
                            )
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()
            with open(filename, 'w', encoding='utf-8') as f:
                f.write(self.t1.GetValue())     # ??????????????
项目:Boms-Away    作者:Jeff-Ciesielski    | 项目源码 | 文件源码
def on_export(self, event):
        """
        Gets a file path via popup, then exports content
        """

        exporters = plugin_loader.load_export_plugins()

        wildcards = '|'.join([x.wildcard for x in exporters])

        export_dialog = wx.FileDialog(self, "Export BOM", "", "",
                                      wildcards,
                                      wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)

        if export_dialog.ShowModal() == wx.ID_CANCEL:
            return

        base, ext = os.path.splitext(export_dialog.GetPath())
        filt_idx = export_dialog.GetFilterIndex()

        exporters[filt_idx]().export(base, self.component_type_map)
项目:multiplierz    作者:BlaisProteomics    | 项目源码 | 文件源码
def file_chooser(title='Choose a file:', default_path = '', default_file = '',
                 mode='r', wildcard='*', parent_obj = None):
    """Provides a file chooser dialog and returns the file path(s) when the file(s) is selected.
    mode option provides file dialog type: read single, read multiple, or save single.
    mode = 'r' creates an 'Open' file dialog for single file read.
    mode = 'm' creates an 'Open' file dialog for multiple files read.
    mode = 'w' creates a 'Save' file dialog.

    wildcard option can be specified as "*.xls"

    Example:
    >> file_chooser(title='Choose a file:', mode='r')

    """

    wildcard = "%s|%s" % (wildcard, wildcard)

    style = { 'r': wx.FD_OPEN,
              'm': wx.FD_MULTIPLE,
              'w': wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT }[mode]

    try:
        file_chooser = wx.FileDialog(parent_obj, title, wildcard=wildcard, style=style,
                                     defaultDir = default_path, defaultFile = default_file)
    except wx._core.PyNoAppError:
        app = mzApp()
        app.launch()
        file_chooser = wx.FileDialog(parent_obj, title, wildcard=wildcard, style=style,
                                     defaultDir = default_path, defaultFile = default_file)


    file_name = None
    if file_chooser.ShowModal() == wx.ID_OK:
        if mode == 'm':
            file_name = file_chooser.GetPaths()
        else:
            file_name = file_chooser.GetPath()
    file_chooser.Destroy()

    return file_name
项目:hachoir3    作者:vstinner    | 项目源码 | 文件源码
def file_save_dialog(title):
    dialog_style = wx.FD_SAVE

    dialog = wx.FileDialog(
        None, message=title,
        defaultDir=os.getcwd(),
        defaultFile='', style=dialog_style)

    return dialog
项目:Migrate2WinSSHTerm    作者:P-St    | 项目源码 | 文件源码
def get_con_xml_path(self):
        style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
        dialog = wx.FileDialog(self, message='Save connections.xml',defaultFile='connections.xml', wildcard='connections.xml|connections.xml', style=style)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
        else:
            path = None
        dialog.Destroy()
        return path
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def onSaveFileAs(self, evt):       
        style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
        wildcard = "Arquivo de console GRIPy (*.gripy_console)|*.gripy_console"
        fdlg = wx.FileDialog(self, 'Escolha o arquivo gripy_console', 
                             defaultDir=self.dir_name, 
                             wildcard=wildcard, 
                             style=style
        )
        if fdlg.ShowModal() == wx.ID_OK:
            self.file_name = fdlg.GetFilename()
            self.dir_name = fdlg.GetDirectory()
            self._do_save()
        fdlg.Destroy()
项目:i3ColourChanger    作者:PMunch    | 项目源码 | 文件源码
def OnCreateSnippet(self,event):
        openFileDialog = wx.FileDialog(self, "Save i3 Colour snippet file", os.path.expanduser("~/.i3/"), "","i3 Colour snippet file |*", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if openFileDialog.ShowModal() == wx.ID_CANCEL:
            return
        open(openFileDialog.GetPath(), 'w').close()
        self.config.updateConfig(openFileDialog.GetPath())
        os.system("rm '"+openFileDialog.GetPath()+"'")
        os.system("mv '/tmp/i3tmpconf' '"+openFileDialog.GetPath()+"'")
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def NewFile(self,e):

        wcd='All files(*)|*'
        dest = 'stopgo_project_'
        destid = int(time.time())

        try:
            dirname = self.clargs['project']
        except OSError:
            dirname = os.path.expanduser('~')
        except:
            dirname = os.path.join(os.path.expanduser('~'),self.myprefs['dir'])

        sd = wx.FileDialog(self, message='Save file as...', 
            defaultDir=dirname, defaultFile='stopgo_project_' + str(destid),
            wildcard=wcd, 
            style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)

        if sd.ShowModal() == wx.ID_OK:
            projnam = sd.GetFilename()
            projpath= os.path.join(sd.GetPath(),projnam)

            # make the directory 
            # the OS does this for us but just in case..
            #if not os.path.exists( os.path.dirname(projpath) ):
                #os.makedirs( os.path.dirname(projpath))
            # make image dir
            os.makedirs( os.path.join(os.path.dirname(projpath),'images'))


        dbfile = projpath
        self.imgdir = os.path.join(os.path.dirname(projpath), 'images')
        logging.exception(dbfile)
        logging.exception(projpath)
        logging.exception(self.imgdir)

        self.con = sq.connect(dbfile, isolation_level=None )

        self.cur = self.con.cursor()
        self.cur.execute("CREATE TABLE IF NOT EXISTS Project(Id INTEGER PRIMARY KEY, Path TEXT, Name TEXT, [timestamp] timestamp)")
        self.cur.execute("CREATE TABLE IF NOT EXISTS Timeline(Id INTEGER PRIMARY KEY, Image TEXT, Blackspot INT)")
        self.cur.execute("INSERT INTO Project(Path, Name, timestamp) VALUES (?,?,?)", ("images", "StopGo Project", datetime.now() ))
        #self.con.close()
        self.BindKeys(dbfile)

        sb = self.GetStatusBar()
        stat = os.path.basename(projpath) + ' created'
        sb.SetStatusText(stat, 0)
        sb.SetStatusText('', 1)
        sd.Destroy()
项目:multiplierz    作者:BlaisProteomics    | 项目源码 | 文件源码
def report_chooser(title=None, mode='r', parent = None, **kwargs):
    '''A specialized file_chooser function for multiplierz files. Otherwise,
    works just like file_chooser.

    'parent' is the parent of the dialog--used when this is called by a GUI
    element. It is perfectly fine to leave it as None, and the GUI frame will
    have no parent.

    'title' can be left blank for the following default titles based on mode:
    r - 'Choose multiplierz File:'
    w - 'Save File:'
    m - 'Choose multiplierz Files:'

    'mode' is one of 'r', 'w', and 'm', just as for file_chooser.

    **kwargs can include any additional options to pass to the FileDialog constructor,
    such as defaultDir (default directory).'''

    # For legacy reasons, these are often misplaced in scripts.
    # But they're both necessarily typed differently, so its sortable.
    if isinstance(parent, basestring) and not isinstance(title, basestring):
        title, parent = parent, title

    wildcard = ("Worksheets (*.xls; *.xlsx)|*.xls; *.xlsx|"
                "Comma-separated Values (*.csv)|*.csv|"
                "mzResults Database (*.mzd)|*.mzd|"
                "mzIdentML (*.mzid)|*.mzid")

    if not title:
        title = {'r': 'Choose multiplierz File:',
                 'w': 'Save File:',
                 'm': 'Choose multiplierz Files:'}[mode]

    style = { 'r': wx.FD_OPEN,
              'm': wx.FD_MULTIPLE,
              'w': wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT }[mode]

    #index = {'.xls': 0,
             #'.xlsx': 0,
             #'.csv': 1,
             #'.mzd': 2}[settings.default_format]

    index = 0

    try:
        file_dialog = wx.FileDialog(parent, title, wildcard=wildcard, style=style, **kwargs)
    except wx._core.PyNoAppError as err:
        app = mzApp()
        app.launch()
        file_dialog = wx.FileDialog(None, title, wildcard=wildcard, style=style, **kwargs)
    file_dialog.SetFilterIndex(index)

    file_name = None
    if file_dialog.ShowModal() == wx.ID_OK:
        if mode == 'm':
            file_name = file_dialog.GetPaths()
        else:
            file_name = file_dialog.GetPath()
    file_dialog.Destroy()

    return file_name