python类askopenfilename()的实例源码

kimmo.py 文件源码 项目:RePhraser 作者: MissLummie 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def loadTypetoTarget(self, fileType, targetWindow, ftype = None):

        if not (fileType and targetWindow): return

        from tkFileDialog import askopenfilename
        ftypes = [(fileType, fileType)]

        filename = askopenfilename(filetypes=ftypes, defaultextension=fileType)

        self.loadIntoWindow(filename, targetWindow)

        # set the config menu to blank
        self.configsMenuButton.configure(text='<none>')

        # !!! remember to reset all the filenames as well!
        if filename:
            if ftype == 'l': self.lexfilename = filename
            elif ftype == 'r': self.rulfilename = filename
PyFusionWindow.py 文件源码 项目:PyFusionGUI 作者: SyntaxVoid 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def restore_clustering(self):
        # A window pops up asking the user to specify the path of a *.ANobj (Analysis Object) file
        # and attempts to restore it using the Analysis.restore classmethod. Then opens a ClusteringWindow
        # which gives the user the option to plot clusters, save the object, or close the window.
        fname = askopenfilename(initialdir=IRIS_CSCRATCH_DIR,
                                filetypes=(("Analysis File Object", "*.ANobj"), ("All Files", "*.*")))
        if fname == "" or fname == (): return None
        try:
            self.AN = analysis.Analysis.restore(fname)
            self._restore_settings_from_loaded_object()
            self.root.event_generate("<<clustering_restored>>", when="tail")
            self.using_analysis_var.set("Using analysis object from\n{}".format(jt.break_path(fname, 24)))
            self.using_analysis_label.config(fg="dark green")
        except:
            ErrorWindow(self.root, "Incorrect file format.")
        return None
chart.py 文件源码 项目:Verideals 作者: Derrreks 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def load_chart(self, *args):
        "Load a chart from a pickle file"
        filename = askopenfilename(filetypes=self.CHART_FILE_TYPES,
                                   defaultextension='.pickle')
        if not filename: return
        try:
            chart = pickle.load(open(filename, 'r'))
            self._chart = chart
            self._cv.update(chart)
            if self._matrix: self._matrix.set_chart(chart)
            if self._matrix: self._matrix.deselect_cell()
            if self._results: self._results.set_chart(chart)
            self._cp.set_chart(chart)
        except Exception, e:
            raise
            tkMessageBox.showerror('Error Loading Chart',
                                   'Unable to open file: %r' % filename)
kimmo.py 文件源码 项目:Verideals 作者: Derrreks 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def loadTypetoTarget(self, fileType, targetWindow, ftype = None):

        if not (fileType and targetWindow): return

        from tkFileDialog import askopenfilename
        ftypes = [(fileType, fileType)]

        filename = askopenfilename(filetypes=ftypes, defaultextension=fileType)

        self.loadIntoWindow(filename, targetWindow)

        # set the config menu to blank
        self.configsMenuButton.configure(text='<none>')

        # !!! remember to reset all the filenames as well!
        if filename:
            if ftype == 'l': self.lexfilename = filename
            elif ftype == 'r': self.rulfilename = filename
SIGMAEditor.py 文件源码 项目:adtree-py 作者: uraplutonium 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def load_event_seq_file():
    global FILE_NAME, EVENT_SEQ
    import tkFileDialog
    FILE_NAME = tkFileDialog.askopenfilename(
        filetypes=[("Event sequence file", ".txt")])
    try:
        file = open(FILE_NAME, "r")
        contents = file.read()
        file.close()
        print "Here are the contents of the event sequence file as read in: "
        print contents
        lines = contents.split("\n")
    except:
        print "Could not load new data from file: ", FILE_NAME
        return
    # Parse the contents:
    EVENT_SEQ = lines
    #print "EVENT_SEQ = "+str(EVENT_SEQ)
annotate.py 文件源码 项目:SceneDensity 作者: ImOmid 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def press(button):
    if button == "Browse":
        global videoFile
        videoFile = tkFileDialog.askopenfilename()
        pathwin.setEntry("Path", videoFile)
    elif button == "Submit":
        global seconds
        seconds = int(pathwin.getEntry("Seconds"))
        pathwin.stop()
data.py 文件源码 项目:uhg-plancheck 作者: jsfrench 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def askopenfilename(self):
        """Returns a file name """

        filename = tkFileDialog.askopenfilename(**self.file_opt)
        if filename:
            return filename
tkconch.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def getIdentityFile(self):
        r = tkFileDialog.askopenfilename()
        if r:
            self.identity.delete(0, Tkinter.END)
            self.identity.insert(Tkinter.END, r)
Tk_utils.py 文件源码 项目:python-utils 作者: gappleto97 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def file_dialog(*args, **kargs):
    import sys
    if sys.version_info[0] <= 2:
        import tkFileDialog, Tkinter
    else:
        import tkinter as Tkinter
        from tkinter import filedialog as tkFileDialog
    f = Tkinter.Tk()
    f.withdraw()
    ret = tkFileDialog.askopenfilename(*args, **kargs)
    f.destroy()
    return ret
prova_gui.py 文件源码 项目:software-suite-movie-market-analysis 作者: 93lorenzo 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def mainPredSet(init):
    filename = fd.askopenfilename()
    root  = Tk()
    init.destroy()
    Label(root,text = " Testing data from file... ").pack(padx= 20,pady=20)
    root.wm_minsize(width=150, height=150)
    fetchPredSet(filename,root)
metlab.py 文件源码 项目:metlab 作者: norling 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _open_file(self, *args):
        self.infile = "'%s'" % tkFileDialog.askopenfilename() # quote name in case of whitespace
        if args[0] in self.arg_info:
            self.arg_value[args[0]].set(self.infile.strip('\''))
            self.arg_info[args[0]].set("[%s]" % self.infile.split('/')[-1].strip('\''))
ximaexport-gui.py 文件源码 项目:XimaExport 作者: ryankomodo 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def openFile(self):
        self.db_entry.delete(0,tk.END)
        ftypes=[('sqlite files','*.sqlite'),('ALL files','*')]
        filename=askopenfilename(filetypes=ftypes)
        self.db_entry.insert(tk.END,filename)
        if len(filename)>0:
            #print('Database file: %s' %filename)
            printch('?:')
        print('   '+filename)
            self.probeAlbums()
tkgui.py 文件源码 项目:ATX 作者: NetEaseGame 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def _run_selectfile(self):
        filename = tkFileDialog.askopenfilename(**dict(
            filetypes=[('All files', '.*'), ('Python', '.py')],
            title='Select file'))
        self._attachfile_text.set(filename)
        if filename:
            self._btn_runedit.config(state=tk.NORMAL)
        print(filename)
spgl.py 文件源码 项目:SPGL 作者: wynand1004 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def ask_open_filename(self):
        return filedialog.askopenfilename()
spgl.py 文件源码 项目:SPGL 作者: wynand1004 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def ask_open_filename(self):
        return filedialog.askopenfilename()
GUI.py 文件源码 项目:Scoary 作者: AdmiralenOla 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def BrowseButtonClickGPA(self):
        """
        Browse button for gene presence absence field
        """
        myfile = \
            tkFileDialog.askopenfilename(
            filetypes=[('comma-separated values', '.csv'),
                       ('all files','.*')])
        self.GPAentryVariable.set(myfile)
GUI.py 文件源码 项目:Scoary 作者: AdmiralenOla 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def BrowseButtonClickTraits(self):
        """
        Browse button for traits field
        """
        myfile = \
            tkFileDialog.askopenfilename(
            filetypes=[('comma-separated values', '.csv'),
                       ('all files','.*')])
        self.TraitsentryVariable.set(myfile)
GUI.py 文件源码 项目:Scoary 作者: AdmiralenOla 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def BrowseButtonClickTreeFile(self):
        """
        Browse button for tree field
        """
        myfile = \
            tkFileDialog.askopenfilename(
            filetypes=[('newick tree files', '.nwk'),
                       ('all files','.*')])
        self.TreeentryVariable.set(myfile)
GUI.py 文件源码 项目:Scoary 作者: AdmiralenOla 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def BrowseButtonClickRestrict(self):
        """
        Browse button for isolate restriction field
        """
        myfile = \
            tkFileDialog.askopenfilename(
            filetypes=[('comma-separated values','.csv'),
                       ('all files','.*')])
        self.RestrictVariable.set(myfile)
main.py 文件源码 项目:goreviewpartner 作者: pnprog 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def launch_analysis():
    global popups
    filename = tkFileDialog.askopenfilename(parent=app,title='Choose a file',filetypes = [('sgf', '.sgf')])
    log(filename)
    log("gamename:",filename[:-4])
    if not filename:
        return
    log("filename:",filename)

    top = Toplevel()

    bots=[]
    Config = ConfigParser.ConfigParser()
    Config.read(config_file)
    if Config.get("Leela","Command")!="":
        bots.append(("Leela",leela_analysis.RunAnalysis))
    if Config.get("AQ","Command")!="":
        bots.append(("AQ",aq_analysis.RunAnalysis))
    if Config.get("Ray","Command")!="":
        bots.append(("Ray",ray_analysis.RunAnalysis))
    if Config.get("GnuGo","Command")!="":
            bots.append(("GnuGo",gnugo_analysis.RunAnalysis))

    new_popup=RangeSelector(top,filename,bots=bots)
    new_popup.pack()
    popups.append(new_popup)
    top.mainloop()


问题


面经


文章

微信
公众号

扫码关注公众号