当前位置: 首页>>代码示例>>Python>>正文


Python tkFileDialog.askopenfilenames函数代码示例

本文整理汇总了Python中tkFileDialog.askopenfilenames函数的典型用法代码示例。如果您正苦于以下问题:Python askopenfilenames函数的具体用法?Python askopenfilenames怎么用?Python askopenfilenames使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了askopenfilenames函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_track

    def add_track(self):                                
        """
        Opens a dialog box to open files,
        then stores the tracks in the playlist.
        """
        # get the filez
        if self.options.initial_track_dir=='':
        	    filez = tkFileDialog.askopenfilenames(parent=self.root,title='Choose the file(s)')
        	
        else:
        	    filez = tkFileDialog.askopenfilenames(initialdir=self.options.initial_track_dir,parent=self.root,title='Choose the file(s)')
        	    
        filez = self.root.tk.splitlist(filez)
        for file in filez:
            self.file = file
            if self.file=="":
                return
            self.options.initial_track_dir = ''
            # split it to use leaf as the initial title
            self.file_pieces = self.file.split("/")
            
            # append it to the playlist
            self.playlist.append([self.file, self.file_pieces[-1],'',''])
            # add title to playlist display
            self.track_titles_display.insert(END, self.file_pieces[-1])
	
	# and set the selected track
	if len(filez)>1:
	    index = self.playlist.length() - len(filez)
	else:
	    index = self.playlist.length() - 1
	self.playlist.select(index)
	self.display_selected_track(self.playlist.selected_track_index())
开发者ID:popiazaza,项目名称:tboplayer,代码行数:33,代码来源:tboplayer.py

示例2: vyberSouboruu

def vyberSouboruu():  
    #print u"tak jsem uvnitø funkce a právì tisknu tuto vìtu :-)"
    import tkFileDialog  
    nazev=tkFileDialog.askopenfilenames(filetypes=(('image files', '*.jpg *.png *.gif'), ('all files', '*.*')))
    #print nazev
    vstup.delete(0, END)
    vstup.insert(0, nazev)  
开发者ID:kelidas,项目名称:scratch,代码行数:7,代码来源:zmensit.py

示例3: loadFromJSON

 def loadFromJSON(self):
     flist = tkFileDialog.askopenfilenames(title="Open captions file...",
                                          filetypes = [("JSON file", "*.json"),
                                                       ("All files", "*")],
                                          initialfile = "captions.json",
                                          multiple = False)
     if flist:  
         name = compatibleFileDialogResult(flist)[0]
     try:
         f = open(name)
         str = f.read()
         f.close()
         try:
             cap = fromJSON(str)
         except ValueError:
             showerror(title = "Error:",
                       message = "file: "+name+" is malformed!")                
         if type(cap) == type({}):
             self.album.captions = cap
             caption = self.album.getCaption(self.selection)
             self.textedit.delete("1.0", END)
             self.textedit.insert(END, caption)                
         else:
             showerror(title = "Error:",
                       message = "file "+name+" does not contain a\n"+
                                 "captions dictionary")                
     except IOError:
         showerror(title = "Error:",
                   message = "could not read file: "+name)
开发者ID:tst-wseymour,项目名称:research,代码行数:29,代码来源:GWTPhotoAlbumCreator.py

示例4: _add_mdout

 def _add_mdout(self):
    """ Get open filenames """
    fnames = askopenfilenames(title='Select Mdout File(s)', parent=self,
                              filetypes=[('Mdout Files', '*.mdout'),
                                         ('All Files', '*')])
    for f in fnames:
       self.mdout += AmberMdout(f)
开发者ID:swails,项目名称:mdout_analyzer,代码行数:7,代码来源:menus.py

示例5: SelectBDFs

def SelectBDFs():
    FilesSelected = tkFileDialog.askopenfilenames(title = "Select File(s)", filetypes=[("allfiles","*")] )
    FilesSelected = Fix_askopenfilenames1( FilesSelected )
    #print "--SelectFilesForCSV(in DEF)[after fix]:"
    #for i in FilesSelected:
    #    print i
    BDFin.set( FilesSelected )   
开发者ID:MPH01,项目名称:MicaDeckCheck_A,代码行数:7,代码来源:Mica+DeckCheck_v0.01.py

示例6: read_matfile

def read_matfile(infiles=None):
    """function to read in andrew's matlab files"""
    master=Tk()
    master.withdraw()
    if infiles==None:
        infiles=tkFileDialog.askopenfilenames(title='Choose one or more matlab TOD file',initialdir='c:/ANC/data/matlab_data/')
        infiles=master.tk.splitlist(infiles)
    data_arrays=np.zeros(0)
    datad={}
    vlowarray=[]
    vhiarray=[]
    gainarray=[]
    for filename in infiles:
        #print filename
        mat=scipy.io.loadmat(filename)
        toi=-mat['out']['V1'][0][0][0]/(mat['out']['Vb'][0][0][0][0]-mat['out']['Va'][0][0][0][0])
        gainarray.append(1.)
        vlowarray.append(mat['out']['Va'][0][0][0][0])
        vhiarray.append(mat['out']['Vb'][0][0][0][0])
        samplerate=np.int(1/(mat['out']['t'][0][0][0][1]-mat['out']['t'][0][0][0][0]))
        data_arrays=np.concatenate((data_arrays,toi),axis=0)
    datad['data']=data_arrays
    datad['samplerate']=samplerate
    datad['gain']=np.array(gainarray)
    datad['v_low']=np.array(vlowarray)
    datad['v_hi']=np.array(vhiarray)
    return datad
开发者ID:shanencross,项目名称:21cm_sim_tools,代码行数:27,代码来源:peakanalysis.py

示例7: browse

def browse():
	global filez
	filez = tkFileDialog.askopenfilenames(parent=root,title='Choose a file')
	entry = ''
	for fil in filez:
		entry =entry+fil+", "
	fileEntry.set(entry)
开发者ID:shivanshuag,项目名称:p2p,代码行数:7,代码来源:client.py

示例8: getData

    def getData(self):
        """Read the data from txt files"""
        try:
            import matplotlib.pyplot as plt
            self.names = tkFileDialog.askopenfilenames(title='Choose acceleration files')
            self.num = 0
            for name in self.names:
                if(self.option == 0):
                    self.data = genfromtxt(name, delimiter=';')
                else:
                    self.data = genfromtxt(name, delimiter=',')
                self.lista.append(self.data)
                self.num = self.num + 1

            #Offset of each sample
            self.offsets =  zeros((1,self.num));
            self.limit_l = 0
            self.limit_r = 100
            self.off = tk.Scale(self.master, from_=-1000, to=1000, orient=tk.HORIZONTAL, resolution=1, length=600, command = self.setOffset, label = 'Offset')
            self.off.grid(row=7,column=0, columnspan = 5)
            self.ri = tk.Scale(self.master, from_=-800, to=800, orient=tk.HORIZONTAL, resolution=1, length=600, command = self.setLimit_r, label = 'Right limit')
            self.ri.set(self.limit_r)
            self.ri.grid(row=8,column=0, columnspan = 5)
            self.le = tk.Scale(self.master, from_=-1000, to=1000, orient=tk.HORIZONTAL, resolution=1, length=600, command = self.setLimit_l, label = 'Left limt')
            self.le.set(self.limit_l)
            self.le.grid(row=9,column=0, columnspan = 5)
            self.plotData("all")
            self.new_lista = self.lista
        except:
            showerror("Error in the files")
开发者ID:enriquecoronadozu,项目名称:HMPy,代码行数:30,代码来源:preGUI.py

示例9: loadParty

	def loadParty(self):
		load_files = tkFileDialog.askopenfilenames(title='Choose which party members to add', initialdir='save_files/',filetypes=[('', '*.ddchar')])
		for load_file in load_files:
			name = load_file
			print name

		return
开发者ID:theMostToast,项目名称:D-D-Encounter,代码行数:7,代码来源:encounter_gui.py

示例10: open_files

 def open_files(self):
     filetypes = [('All files', '.*'), ('Comic files', ('*.cbr', '*.cbz', '*.zip', '*.rar', '*.pdf'))]
     f = tkFileDialog.askopenfilenames(title="Choose files", filetypes=filetypes)
     if not isinstance(f, tuple):
         f = self.master.tk.splitlist(f)
     self.filelist.extend(f)
     self.refresh_list()
开发者ID:devernay,项目名称:kcc,代码行数:7,代码来源:gui.py

示例11: chooseFile

    def chooseFile(self):
       
        
        filez = tkFileDialog.askopenfilenames()
        splitFilez = self.tk.splitlist(filez)
        tex.insert(tk.END,'============================================================================\n')
        tex.insert(tk.END,'Adding File\n')
        tex.see(tk.END)
        tex.update_idletasks()
        for item in splitFilez :
            print "ADD %s" %item
            tex.insert(tk.END,'{}  Added\n'.format(item))
            tex.see(tk.END)
            tex.update_idletasks()
            openIt = open(item,'r')
            allFile.append(item) #each file
##            self.checkEnd(item)
##            file_contents = openIt.read()
##            print file_contents
##            loadT.append(file_contents)
##            openIt.close()
##        a = ''.join(loadT)
##        b =  a.rstrip()
##        for word in word_tokenize(b):
##            try:
##        loadTr.append(word)
        tex.insert(tk.END,'Adding Completed \n')
        tex.insert(tk.END,'============================================================================\n')
        tex.see(tk.END)
        tex.update_idletasks()
        checkLoad.append('a')
开发者ID:Centpledge,项目名称:BUILDING-2,代码行数:31,代码来源:Text_mining_GUI.py

示例12: selectFiles

def selectFiles():
    fnameEncode = tkFileDialog.askopenfilenames(filetypes=[('Excel file', '*.xls;*.xlsx')], multiple=1)
    #sysencode = sys.getfilesystemencoding()
    #fnameDecode = fnameEncode.encode(sysencode)
    #fnameTmpArray = root.tk.splitlist(fnameEncode)
    #fnameArray = [unicode(i, encoding=sysencode) for i in fnameTmpArray]
    print fnameEncode
开发者ID:personal-wu,项目名称:switch,代码行数:7,代码来源:file_dialog.py

示例13: changeLbox

 def changeLbox(self, mytab):         
     root = gFunc.getRoot(mytab)
     mynewdata = tfgiag.askopenfilenames(parent=root,title='Choose a file',filetypes=[('CSV files', '.csv')])
     vals = []
     self.mainEventBox["values"] = vals
     if mynewdata:
         #reset old variables
         self.pb.start()
         self.data.maindata = pd.DataFrame()     
         self.lbox.delete(0, self.lbox.size())
         #populate lists and data
         for myfile in root.tk.splitlist(mynewdata): 
             foo = pd.read_csv(myfile, error_bad_lines=False)   
             if (self.data.maindata.empty):
                 self.data.setMainData(foo)
             else:
                 self.data.appendMainData(foo)
             eventlist = []
             for eventID in foo["Event ID"].unique():
                 self.lbox.insert(END, eventID)
                 eventlist.append(eventID)
                 vals.append(eventID)
             print myfile
         self.mainEventBox["values"] = vals
         self.mainEventBox.set(vals[0])
         self.pb.stop()
     else:
         print "Cancelled"
     return mynewdata
开发者ID:itaraday,项目名称:FunFactFinder,代码行数:29,代码来源:GuiEventsTab.py

示例14: merge_dictionaries

def merge_dictionaries():
    global student_dict,student
    #Similar code as above, although the point here would be to merge past student grades dictionary
    # with the sample transcript
    name=askopenfilenames()
    student_data=[]  # Will contain a list of tuples with selected student names and name of files
    student_info={}
    for i in range(len(name)):
        address=name[i]
        filename=""
        for i in range(len(address)-1,-1,-1):
            if address[i]=='/':
                break
            filename+=address[i]
        filename=filename[::-1].encode('ascii')
        student_name=filename.split('.')[0].encode('ascii')
        student_data.append((student_name, filename))

    for student_name,filename in student_data:
        student_info.setdefault(student_name,{})
        student_info[student_name]=grades_dictionary(filename)
    #Here we are able to extract the user/student name that we will merge with past student grades
    # Effectively we create one dictionary with all the data we need
    student = student_data[0][0]
    student_dict[student]=student_info[student]
    print student_dict
开发者ID:DrJayLight,项目名称:Course_Recommendation_System,代码行数:26,代码来源:jareth_moyo.py

示例15: browseFiles

 def browseFiles(self):
     longFileNameList = tkFileDialog.askopenfilenames(initialdir=self.currentFileDir, title="Load files")
     longFileNameList = list(self.parent.tk.splitlist(longFileNameList))
     if longFileNameList:
         longFileNameList = [os.path.normpath(p) for p in longFileNameList]
         self.currentFileDir = os.path.dirname(longFileNameList[0])
         self.loadFiles(longFileNameList)
开发者ID:magnusdv,项目名称:filtus,代码行数:7,代码来源:Filtus.py


注:本文中的tkFileDialog.askopenfilenames函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。