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


Python filedialog.askopenfilenames方法代码示例

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


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

示例1: openfile

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def openfile(self, event):
        if event.widget["text"] == "..":
            intput_type = self.input_type.get()
            if not intput_type:
                messagebox.showerror("Error", "please select the input type first.")
                return
            if intput_type == "video":
                self.input_filename = askopenfilenames(title='select', filetypes=[
                    ("all video format", ".mp4"),
                    ("all video format", ".flv"),
                    ("all video format", ".avi"),
                ])
            elif intput_type == "image":
                self.input_filename = askopenfilenames(title='select', filetypes=[
                    ("image", ".jpeg"),
                    ("image", ".png"),
                    ("image", ".jpg"),
                ])
            self.label0_["text"] = self.input_filename
        elif event.widget["text"] == "...":
            self.output_dir = askdirectory(title="select")
            self.label1_["text"] = self.output_dir 
开发者ID:MashiMaroLjc,项目名称:rabbitVE,代码行数:24,代码来源:extract_face_view.py

示例2: _open_file

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def _open_file(self):
        paths = filedialog.askopenfilenames(filetypes=[('PDF files', '*.pdf'),
                                                       ('JPG files', '*.jpg'),
                                                       ('PNG files', '*.png'),
                                                       ('all files', '.*')],
                                            initialdir=os.getcwd(),
                                            title="Select files", multiple=True)
        if not paths or paths == '':
            return
        paths = [path for path in paths if os.path.basename(path).split('.')[-1].lower() in ['pdf', 'jpg', 'png']]
        self.paths = self.paths[:self.pathidx + 1] + list(paths) + self.paths[self.pathidx + 1:]
        self.total_pages = len(self.paths)
        self.pathidx += 1
        self._load_file() 
开发者ID:naiveHobo,项目名称:pdfviewer,代码行数:16,代码来源:pdfviewer.py

示例3: select_file

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def select_file(self):
        try:
            #result = self.value.get()
            init_dir = self.runner.working_dir
            ftypes = [('All files', '*.*')]
            if 'RasterAndVector' in self.file_type:
                    ftypes = [("Shapefiles", "*.shp"), ('Raster files', ('*.dep', '*.tif',
                                                '*.tiff', '*.flt',
                                                '*.sdat', '*.rdc',
                                                '*.asc'))]
            elif 'Raster' in self.file_type:
                ftypes = [('Raster files', ('*.dep', '*.tif',
                                            '*.tiff', '*.flt',
                                            '*.sdat', '*.rdc',
                                            '*.asc'))]
            elif 'Lidar' in self.file_type:
                ftypes = [("LiDAR files", ('*.las', '*.zlidar', '*.zip'))]
            elif 'Vector' in self.file_type:
                ftypes = [("Shapefiles", "*.shp")]
            elif 'Text' in self.file_type:
                ftypes = [("Text files", "*.txt"), ("all files", "*.*")]
            elif 'Csv' in self.file_type:
                ftypes = [("CSC files", "*.csv"), ("all files", "*.*")]
            elif 'Html' in self.file_type:
                ftypes = [("HTML files", "*.html")]

            result = filedialog.askopenfilenames(
                initialdir=init_dir, title="Select files", filetypes=ftypes)
            if result:
                for v in result:
                    self.opt.insert(tk.END, v)

                # update the working directory
                self.runner.working_dir = os.path.dirname(result[0])

        except:
            messagebox.showinfo("Warning", "Could not find file") 
开发者ID:giswqs,项目名称:WhiteboxTools-ArcGIS,代码行数:39,代码来源:wb_runner.py

示例4: import_map

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def import_map(self):
        self.filepath, = filedialog.askopenfilenames(title='Import shapefile')
        self.draw_map() 
开发者ID:afourmy,项目名称:pyGISS,代码行数:5,代码来源:pyGISS.py

示例5: import_map

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def import_map(self):
        filepath = tk.filedialog.askopenfilenames(title='Import shapefile')
        if not filepath: 
            return
        else: 
            self.filepath ,= filepath
        self.draw_map() 
开发者ID:afourmy,项目名称:pyGISS,代码行数:9,代码来源:extended_pyGISS.py

示例6: import_nodes

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def import_nodes(self):
        filepath = filedialog.askopenfilenames(filetypes = (('xls files','*.xls'),))
        if not filepath:
            return
        else:
            filepath ,= filepath
        book = xlrd.open_workbook(filepath)
        try:
            sheet = book.sheet_by_index(0)
        # if the sheet cannot be found, there's nothing to import
        except xlrd.biffh.XLRDError:
            warnings.warn('the excel file is empty: import failed')
        for row_index in range(1, sheet.nrows):
            x, y = self.to_canvas_coordinates(*sheet.row_values(row_index))
            self.create_object(x, y) 
开发者ID:afourmy,项目名称:pyGISS,代码行数:17,代码来源:extended_pyGISS.py

示例7: openfiles

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def openfiles(self, filetype):
        paths = filedialog.askopenfilenames(initialdir=self.cur_dir, title="Select file",filetypes=filetype) 
开发者ID:ericchansen,项目名称:q2mm,代码行数:4,代码来源:gui.py

示例8: _filename_multi

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def _filename_multi(self):
        """ Get multiple existing file locations. """
        logger.debug("Popping Filename browser")
        return filedialog.askopenfilenames(**self._kwargs) 
开发者ID:deepfakes,项目名称:faceswap,代码行数:6,代码来源:utils.py

示例9: _get_open_file_func

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
def _get_open_file_func(self, info, label_):
        type_ = info["type"]
        name = info["name"]

        def openfile(event):
            if type_ == param_type.OPEN_FILE:
                file_name = askopenfilenames(title="select a file")
            if type_ == param_type.SAVE_FILE:
                file_name = asksaveasfilename(title="select a file")
            if type_ == param_type.DIR:
                file_name = askdirectory(title="select a file")
            label_["text"] = file_name
            self.register_params[name] = [file_name, type_]

        return openfile 
开发者ID:MashiMaroLjc,项目名称:rabbitVE,代码行数:17,代码来源:plugin_view.py

示例10: plot_navigation

# 需要导入模块: from tkinter import filedialog [as 别名]
# 或者: from tkinter.filedialog import askopenfilenames [as 别名]
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,代码行数:35,代码来源:xtf_util.py


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