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


Python filedialog.askopenfilenames函数代码示例

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


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


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