• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tkFileDialog.askopenfilenames函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: load_data

    def load_data(self):
        

        
        files = tkFileDialog.askopenfilenames(title='Choose files')
        filelist = list(files)
        for filename in filelist:
            if os.path.splitext(filename)[1] == ".p":
                with open(filename, "rb") as openfile:
                    
                    self.processedList.delete(0, tk.END)
                    self.selectedBlocks.delete(0, tk.END)
                    
                    Data.clear_all()
                    
                    self.re_graph()
                    
                    loaded_data = pickle.load(openfile)
                    
                    Data.grand_amps = loaded_data['grand_amps']
                    Data.orient_amplitudes = loaded_data['orient_amplitudes']
                    Data.grand_avgs = loaded_data['grand_avgs']
                    Data.orient_avgs = loaded_data['orient_avgs']
                    Data.total_avgs = loaded_data['total_avgs']
                    Data.total_amplitudes = loaded_data['total_amps']
                    Data.stim_avgs = loaded_data['stim_avgs']
                    
                    for a, b in enumerate(Data.grand_amps):
                        self.processedList.insert(a, b)
                    
                    for a, b in enumerate(Data.stim_avgs):
                        for c in Data.stim_avgs[b]:
                            for i in range(len(Data.stim_avgs[b][c])):
                                if orientations[c][1] == "flip":
                                    self.selectedBlocks.insert(tk.END, orientations[c][0] + " " + str(i+1) + "  " + b)
开发者ID:jtrinity,项目名称:SRP,代码行数:35,代码来源:VEPmaster2.py


示例17: CallSigCal

def CallSigCal(root_window,calcon_in):
    selectedType=DataFormat.get()

    myFormats = [
    ('Miniseed files','*.mseed'),
    ('SAC files','*.sac'),
    ('CSS files','*.wfd'),
    ('All files','*.*')
    ]

    filez = tkFileDialog.askopenfilenames(parent=root_window,title='Use <shift> or <CTRL> to select the data files to include for processing:', \
            initialdir=calcon_in['target_dir'], \
            filetypes=myFormats)

# convert from unicode to str file list
    files = []
    for file in filez:
        files.append(string.replace(str(file), "/", "\\"))
  
#   make sure CalCon is loaded    
    LoadCalCon(calcon_in)
#   show CalCon structure contents before calculation for troubleshooting
    print '\n*** Start Signal Calibration ***'
    print calcon_in  
# call sigcal with list    
    MDTcaldefs.sigcal(calcon_in,files)
开发者ID:tychoaussie,项目名称:MDTCal,代码行数:26,代码来源:MDTcal.py


示例18: Open

def Open(location = None):
    global text
    global currentFile
    global password

    if "instance" in str(type(location)):
        location = None

    if location == None:
        openlocation = tkFileDialog.askopenfilenames()[0]
    else:
        openlocation = location

    if openlocation == "":
        return
    
    GetPassword()

    if not decrypt(openlocation, "temp", password):
        print "Bad password"
        RemoveTemp()
        return

    with open("temp", "r") as file1:
        data = file1.read()
    
    RemoveTemp()

    text.delete(1.0, END)
    text.insert(CURRENT, data)
    currentFile = openlocation
开发者ID:gal704,项目名称:scripts,代码行数:31,代码来源:gui.py


示例19: __load_genepop_files

	def __load_genepop_files( self ):

		s_current_value=self.__genepopfiles.get()

		#dialog returns sequence:
		q_genepop_filesconfig_file=tkfd.askopenfilenames(  \
				title='Load a genepop file' )

	
		if len( q_genepop_filesconfig_file ) == 0:
			return
		#end if no files selected

		#string of files delimited, for member attribute 
		#that has type tkinter.StringVar
		s_genepop_files=DELIMITER_GENEPOP_FILES.join( \
								q_genepop_filesconfig_file )
		self.__genepopfiles.set(s_genepop_files)

		self.__init_interface()
		self.__load_param_interface()
		self.__set_controls_by_run_state( self.__get_run_state() )

		if VERY_VERBOSE:
			print ( "new genepop files value: " \
					+ self.__genepopfiles.get() )
		#end if very verbose

		return
开发者ID:popgengui,项目名称:negui,代码行数:29,代码来源:pgguineestimator.py


示例20: getImages

def getImages():
  images = []
  
  # only allow jpgs
  #options = {}
  #options['filetypes'] = [('JPG files', '*.jpg')]
  
  # ask the user to select the images to process
  Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
  # files = askopenfiles(mode="r", **options) # show an "Open" dialog box and return a list of files
  filenames = askopenfilenames() # show an "Open" dialog box and return a list of files
  filenames = filenames.split() # work around for windows python bug: http://bugs.python.org/issue5712
  
  for filename in filenames:
    print filename
    try:
      im = Image.open(filename)
      images.append(im)
      # images must be the same size
      assert(images[0].size[0] == im.size[0])
      assert(images[0].size[1] == im.size[1])
    except:
      break

  # the user must have select 2 or more images
  assert(len(images) > 1)

  return images
开发者ID:drewsherman,项目名称:Photography,代码行数:28,代码来源:imagetest.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tkFileDialog.asksaveasfile函数代码示例发布时间:2022-05-27
下一篇:
Python tkFileDialog.askopenfilename函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap