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

Python filedialog.askopenfilenames函数代码示例

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

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



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

示例1: pickfiles

def pickfiles(name=None):
    root = Tk()
    root.withdraw()
    if name is None:
        filename = filedialog.askopenfilenames(parent=root,
                                               title="Choose DVHs ")
    else:
        filename = filedialog.askopenfilenames(parent=root, title=name)
    filename = list(filename)
    return filename
开发者ID:ybbouchta,项目名称:Graphing,代码行数:10,代码来源:iogui.py


示例2: uigetfullfile

def uigetfullfile(basefilename=""):
    """Act like uigetfile in matlab, returned filename can be multiple
"""
    d = GetFolderName(basefilename)
    root = tk.Tk()
    root.withdraw()
    if len(d) > 0:
        file = filedialog.askopenfilenames(initialdir=d)
    else:
        file = filedialog.askopenfilenames()
    fns = root.tk.splitlist(file)
    return fns
开发者ID:wicknec,项目名称:WalArt,代码行数:12,代码来源:waFile.py


示例3: get_files

	def get_files(self, tk_root):
		if tk_root is not None:
			print("""If you want to pass  files directly do it by interactive_plotting(filenames = list) """)
			root = tk_root
			files = filedialog.askopenfilenames(parent=tk_root,title='Choose files')
			root.quit()
			self.filenames = files
		else:
			print("""If you want to pass  files directly do it by interactive_plotting(filenames = list) """)
			root = Tk()
			root.files = filedialog.askopenfilenames(title='Choose files')
			self.filenames = root.files
			root.withdraw()
开发者ID:copperwire,项目名称:cephalopod,代码行数:13,代码来源:interactive_plotting.py


示例4: selectImages

def selectImages() :
    del selectedImages[:]    # Clear the list of selected images
    x = filedialog.askopenfilenames(filetypes=myfiletypes)
    if x == ('',):
        messagebox.showerror("Unable to read library location","Could not identify the location of the selected file(s). \nInstead of browsing through Windows' libraries, try selecting Desktop in the left hand pane and then open the folder that says your username. \nIdeally, you would browse through the full path of the images. E.g. C:\\Users\\[your username]\\")
    else:
        for y in x:
            selectedImages.append(y)
        # Clear the selectedPicturesFrame
        for child in selectedPicturesFrame.winfo_children():
            child.destroy()
        # Check whether we selected images
        if not selectedImages:
            Label(selectedPicturesFrame,text="None",font="none 9 italic").pack(padx=75)
        else:
            # Create the scrollbar and add it to our frame
            listboxImagesScrollbar = Scrollbar(selectedPicturesFrame,orient=VERTICAL)
            listboxImagesScrollbar.pack(side=RIGHT, fill=Y)
            # Create a listbox and add it to our user interface
            listboxImages = Listbox(selectedPicturesFrame)
            listboxImages.pack(padx=(4,3))
            # Loop through the selected images and add them to the listbox
            for selectedImg in selectedImages:  
                listboxImages.insert(END,path.basename(selectedImg))
            # Configure the scrollbar to interact with the listbox
            listboxImages.config(height=4,width=26,yscrollcommand=listboxImagesScrollbar.set)
            listboxImagesScrollbar.config(command=listboxImages.yview)
开发者ID:Gwyllion,项目名称:python-codelets,代码行数:27,代码来源:ImgResizeMain.py


示例5: plot_navigation

def plot_navigation(paths: List[str] = None):
    """
    Plots navigation packets in the list of files. If paths is None, a file open dialog is shown
    :param paths: List of paths to plot nav data for
    :return: None
    """
    # TODO: Plot navigation from other packets if navigation packets not present.

    # Open file dialog if paths not specified
    if not paths:
        root_gui = tk.Tk()
        root_gui.withdraw()
        paths = filedialog.askopenfilenames(
            title='Select XTF files...',
            filetypes= [('eXtended Triton Files (XTF)', '.xtf')]
        )

    nav = []  # type: List[pyxtf.XTFHeaderNavigation]
    for path in paths:
        (fh, p) = xtf_read(path, types=[XTFHeaderType.navigation])
        if XTFHeaderType.navigation in p:
            nav.extend(p[XTFHeaderType.navigation])

    # Sort by time
    if nav:
        nav.sort(key=XTFHeaderNavigation.get_time)
        x = [p.RawXcoordinate for p in nav]
        y = [p.RawYcoordinate for p in nav]

        plt.plot(x, y)
        plt.show()
    else:
        warn('No navigation packets present in XTF files')
开发者ID:oysstu,项目名称:pyxtf,代码行数:33,代码来源:xtf_util.py


示例6: open_mass_spectrum

    def open_mass_spectrum(self):
        try:
            self.progress.reset_bar()
            data_buffer = []
            files = filedialog.askopenfilenames(title='Select Mass '+
                                                'Spectrum File(s)')

            self.task_label.set('Opening Mass Spectra')
            for index, file in enumerate(files):
                self.progress.counter.set((float(index) /
                        len(files))*100)
                self.progress.update_progress_bar()
                self.filename = file
                mass_spec_buffer = MassSpectrum(self)
                mass_spec_buffer.open_mass_spectrum()
                data_buffer.append(mass_spec_buffer)
            self.mass_spectra = data_buffer
            self.task_label.set('Idle')
            self.progress.fill_bar()

            self.task_label.set('Plotting Mass Spectra')
            if self.mass_spectra:
                self.axes.clear()
                for index, mass_spectrum in enumerate(self.mass_spectra):
                    self.progress.counter.set((float(index) /
                        len(files))*100)
                    self.progress.update_progress_bar()
                    mass_spectrum.plot_mass_spectrum()
                finalize_plot(self)
            self.task_label.set('Idle')
            self.progress.fill_bar()
        except Exception as e:
            messagebox.showinfo('Warning','The selected files could '+
                                'not be opened.')
            self.logger.error(e)
开发者ID:Tarskin,项目名称:MassyTools,代码行数:35,代码来源:MassyTools.py


示例7: main

def main():
    logging_level = logging.DEBUG
    logging.Formatter.converter = time.gmtime
    log_format = '%(asctime)-15s %(levelname)s:%(message)s'
    logging.basicConfig(format=log_format, datefmt='%Y/%m/%d %H:%M:%S UTC', level=logging_level,
                        handlers=[logging.FileHandler('testparsedasbin.log'), logging.StreamHandler()])
    logging.info('_____ Started _____')

    t_step = 5 #60
    home = os.path.expanduser('~')
    start_dir = home
    status = []
    root = Tk()
    root.withdraw()  # this will hide the main window
    list_of_bin_files = filedialog.askopenfilenames(filetypes=('binary {*.bin}', 'Binary files'),
                                                    initialdir = start_dir, initialfile = '')

    for i in list_of_bin_files:
        logging.info('processing ' + i)
        status.append(pdb.parse_bin_files_to_text_files(in_filename=i, verbose_flag=True, dtm_format=True,
                                                        time_step = t_step))
        if status[-1] < 256:
            if status[-1] > 0:
                messagebox.showwarning('Warning', 'Parsing of ' + i + ' ended with warning code ' + str(status[-1])
                                       + '.')
        else:
            messagebox.showerror('Error', 'Parsing of ' + i + ' ended with error code '+ str(status[-1]) + '!')


    logging.info('______ Ended ______')
开发者ID:ozzmos,项目名称:bdas,代码行数:30,代码来源:testparsedasbin.py


示例8: add_files

def add_files(entries, color):
    path = filedialog.askopenfilenames()
    for name in path:
        if color == 'green':
            listbox_green.insert(END, name)
        else:
            listbox_red.insert(END, name)
开发者ID:tinCanBear,项目名称:Retsulc,代码行数:7,代码来源:rand_test.py


示例9: add_files

 def add_files(self):
   errlog = ''
   try:
     open = tkinter.Tk()
     open.withdraw()
     newfiles = filedialog.askopenfilenames()
     newfiles = self.tk.splitlist(newfiles)
   except Exception:
     errlog += "{0}\n".format(traceback.format_exc())
     self.show_error(
         "Unable to add all files.\n" \
         "See Error.log for more information.",
         errlog
         )
   finally:
     filelistpaths = []
     for file in self.file_list:
       filelistpaths.append(file[1])
     newfiles = list(newfiles)
     self.delduplicates(filelistpaths, newfiles)
     
     for file in newfiles:
       self.oldname_lstbx.insert(len(self.file_list), os.path.basename(file))
       self.file_list.append([os.path.basename(file), file])
     self.update_newname()
     open.destroy()
开发者ID:fidelt,项目名称:just-another-bulk-renamer,代码行数:26,代码来源:jabr.py


示例10: abrir_pt1

    def abrir_pt1(self):

        self.status.configure(text = 'Abrindo arquivos...')
        self.arquivos = sorted(filedialog.askopenfilenames(title='Abrir',
                        filetypes=[('SAC','*.sac')]))

        if len(self.arquivos) > 0:

            try:

                for i in self.arquivos:

                    self.sts.append(read(i))

               # for i in self.sts:

                #    print(i[0].stats.station)'''

                self.abrir_pt2()

            except:

                messagebox.showerror("Sismologica","Erro na leitura do arquivo.")
                self.status.configure(text = '')
                del self.sts[:]
                self.arquivo = None
开发者ID:viictorjs,项目名称:Sismologica,代码行数:26,代码来源:Sismologica.py


示例11: selectIMG

    def selectIMG(self):  # function for select target image
        self.imgName.configure(state="normal")  # entry writable
        self.imgName.delete(0, END)  # clear entry area
        self.text.delete(0.0, END)  # clear info area
        path = filedialog.askopenfilenames(
            filetypes=[  # store multiple images as array to path
                ("image files", "*.png *.gif *.bmp"),
                ("All files", "*.*"),
            ]
        )

        self.selectedIMGs = {}  # dict. store the image : size

        for img in path:
            oriSize = os.path.getsize(img)  # size of target file
            self.selectedIMGs[img] = oriSize  # add into the dictionary
            fileName = os.path.basename(img)  # get the filename
            # print(fileName)
            self.imgName.configure(state="normal")  # entry writable
            self.imgName.insert(END, fileName + ";")  # insert the image path
            self.imgName.configure(state="readonly")  # disable entry
            self.text.insert(
                END, fileName + ":" + str(round(oriSize / 1000 / 1000, 3)) + "MB\n"
            )  # display selected size

        return self.selectedIMGs
开发者ID:shunwatai,项目名称:jpeg-image-converter,代码行数:26,代码来源:pyJpegConverter.py


示例12: add_files

 def add_files(self):
     options = {}
     config = self.parent.settings_frame.config
     options['defaultextension'] = config["File"]["Extension"]
     if options['defaultextension'] == ".txt":
         options['filetypes'] = [('Text files', '.txt'), ('XML files', '.xml'),
                                 ('HTML files', '.html')]
     if options['defaultextension'] == ".xml":
         options['filetypes'] = [('XML files', '.xml'), ('Text files', '.txt'),
                                 ('HTML files', '.html')]
     if options['defaultextension'] == ".html":
         options['filetypes'] = [('HTML files', '.html'),
                                 ('Text files', '.txt'),
                                 ('XML files', '.xml')]
     default_dir = config["File"]["InputDir"].strip()
     if os.path.exists(default_dir):
         options['initialdir'] = default_dir
     else:
         options['initialdir'] = ""
     options['initialfile'] = ''
     options['parent'] = self.setup_frame
     options['title'] = 'Open corpus file(s)'
     files_str = filedialog.askopenfilenames(**options)
     for f in self.parent.root.splitlist(files_str):
         self.files.append(f)
         self.listbox.insert("end", os.path.basename(f))
开发者ID:muranava,项目名称:openconc,代码行数:26,代码来源:corpora.py


示例13: getFilenames

def getFilenames(title, types=[], initialdir=None):
    root = Tk()
    root.withdraw()
    filenames = filedialog.askopenfilenames(title=title, filetypes=types,
                                            initialdir=initialdir)
    root.destroy()
    return root.tk.splitlist(filenames)
开发者ID:fedebarabas,项目名称:LabNanofisica,代码行数:7,代码来源:utils.py


示例14: main

def main():
    # Ask for CPU_usage file in text format
    root = tk.Tk()
    root.withdraw()
    Files_sel = filedialog.askopenfilenames()

    Files_l = list(Files_sel)
    Files_l.sort()

    file_name = input("Enter a file name:")

    for files in Files_l:

        tar = tarfile.open(files, mode="r")
        f = tar.getnames()

        for filename in f:
            if "meminfo" in filename:

                f = tar.extractfile(filename)
                content = f.read().splitlines()

                header = header_create(content)

                mem_parse(content, header, file_name)
开发者ID:krishandan,项目名称:Pythonscripts,代码行数:25,代码来源:Memory_parsing.py


示例15: file_chooser

def file_chooser():
	root = Tk()
	root.files = filedialog.askopenfilenames(title='Choose files')
	if len(files) == 1:
		files = files[0]
	root.withdraw()
	return root.files
开发者ID:copperwire,项目名称:cephalopod,代码行数:7,代码来源:path_handler.py


示例16: __init__

    def __init__(self, parent=None):
        self.parent = parent
        self.parent.statusbar.showMessage("AOI Aggregation in process...")
        QWidget.__init__(self,parent)
        
        self.ui = gui.aoiUi()
        self.ui.setupUi(self)
       
        self.batch_files = filedialog.askopenfilenames(parent=root, title='Choose the file(s) you want to AOI aggregate')
        
        if len(self.batch_files) < 1:
            msgBox = QMessageBox()
            msgBox.setGeometry(400, 400, 400, 200)
            msgBox.setText("Please select one or more datasets to aggregate")
            msgBox.move(QApplication.desktop().screen().rect().center()- self.rect().center())
            msgBox.exec_() 
            
            self.close()
            return        
        
        self.columns = []
        
        self.parent.statusbar.showMessage("Checking column validity...")

        #extract columns
        for item in self.batch_files:
            self.columns.append(helpers.extract_columns(item))
 
        #check to see if all columns are equal in all the datasets
        if not helpers.are_columns_same(self.columns):
            if not helpers.columns_not_equal_message(self):
                self.close()
                return
        
        message = ""
        if self.columns != []:
            if 'GazeAOI' not in self.columns[0]:
                message += "'GAZE AOI' "
            if 'FixationAOI' not in self.columns[0]:
                message += "'FIXATION AOI'"
            
        if message != "":
            message += ": Field(s) missing from dataset - try again with appropriate data."
            reply = QMessageBox.question(self, 'Message',message, QMessageBox.Ok, QMessageBox.Ok)
            if reply == QMessageBox.Ok:
                self.parent.statusbar.showMessage("Welcome back!")
                self.close()
                return

        self.parent.ui.logOutput.append("AOI AGGREGATED:")
        print("AOI AGGREGATED:")
        
        self.AOI_aggregate('GazeAOI')
        self.AOI_aggregate('FixationAOI')
       
        #after job has been completed!
        helpers.job_complete_message(self)     
        
        self.parent.statusbar.showMessage("Welcome back!")
        self.close()
开发者ID:micahzev,项目名称:biometric_data_manipulator,代码行数:60,代码来源:data_manipulator.py


示例17: load_new_tables

    def load_new_tables(self):
        '''Opens a file chooser dialog so that the user can choose table files
           to load. Loads these into dicts.'''

        file_opts = {"defaultextension": ".csv",
                     "title": "Choose table file(s)",
                     }
        filenames = filedialog.askopenfilenames(**file_opts)
        for f in filenames:
            table_name = f[f.rfind('/')+1:f.rfind('.csv')]
            try:
                self.tables[table_name] = load_table(f)
            except TableFormatError as err:
                mbox.showwarning("Open file",
                                 "Bad formatting: {}".format(err.err_msg))
                return
            except csvError:
                mbox.showwarning("Open file",
                                 "Cannot open file: Bad CSV input.")
                return
            except FileNotFoundError:
                mbox.showwarning("Open file",
                                 "Cannot open file: File not found.")
                return
            # Update the options in self.table_menu.
            new_comm = tk._setit(self.chosen_table, table_name)
            self.table_menu['menu'].add_command(label=table_name,
                                                command=new_comm)
开发者ID:whonut,项目名称:Random-Table-Roller,代码行数:28,代码来源:gui.py


示例18: do_share

 def do_share(self):
     """Share songs."""
     paths = filedialog.askopenfilenames()
     if isinstance(paths, str):  # http://bugs.python.org/issue5712
         paths = self.master.tk.splitlist(paths)
     logging.debug("paths: {}".format(paths))
     for path in paths:
         self.user.recommend(path)
     self.update()
开发者ID:jacebrowning,项目名称:dropthebeat,代码行数:9,代码来源:gui.py


示例19: showopen

def showopen():
    file_names = filedialog.askopenfilenames(title = "select your favourite song",filetypes=[("mp4 file","*.mp4"),("mp3 file","*.mp3")])
    #askopenfilenames is basically a method of class filedialog present in tkinter module
    print(type(file_names))
    print((file_names))
    str = ""
    for x in file_names:
        str+=x + "\n"
    lbl.configure(text = str)
开发者ID:nageshnemo,项目名称:lets-do-python-all-problems-,代码行数:9,代码来源:revision20(file+chooser+multiple+fies).py


示例20: get_filenames_UI

def get_filenames_UI(UIdir=None, UIcaption='', UIfilters=''):
    """
    Custom function that is equivalent to Matlab's uigetfile command. Returns filename as a string.

    filenamestring = GetFile(UIdir=None,UIcaption='',UIfilters='')
    """
    withdraw_tkinter()
    filenames = askopenfilenames()
    return filenames
开发者ID:gitter-badger,项目名称:pylinac,代码行数:9,代码来源:io.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python filedialog.asksaveasfile函数代码示例发布时间:2022-05-27
下一篇:
Python filedialog.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