python类askdirectory()的实例源码

appjar.py 文件源码 项目:Cryptokey_Generator 作者: 8BitCookie 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def directoryBox(self, title=None, dirName=None):
        self.topLevel.update_idletasks()
        options = {}
        options['initialdir'] = dirName
        options['title'] = title
        options['mustexist'] = False
        fileName = filedialog.askdirectory(**options)
        if fileName == "":
            return None
        else:
            return fileName
pymod_gui.py 文件源码 项目:pymod 作者: pymodproject 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def choose_path(self):
        """
        Called when users press the 'Browse' button in order to choose a path on their system.
        """
        current_path = self.getvalue()
        new_path = None

        # Lets users choose a new path.
        if self.path_type == "file":
            new_path = askopenfilename(title = self.askpath_title,
                initialdir=os.path.dirname(current_path),
                initialfile=os.path.basename(current_path), parent = get_parent_window(self), filetypes = self.file_types)

        elif self.path_type == "directory":
            new_path = askdirectory(title = self.askpath_title, initialdir=os.path.dirname(current_path), mustexist = True, parent = get_parent_window(self))

        # Updates the text in the Entry with the new path name.
        if new_path:
            self.clear()
            self.setvalue(new_path)

        if hasattr(self.run_after_selection, "__call__"):
            self.run_after_selection()
MCS_Functions.py 文件源码 项目:HSL_Dev 作者: MaxJackson 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def get_dirname():
    Tk().withdraw()
    print("Initializing Dialogue...\nPlease select a directory.")
    dirname = askdirectory(initialdir=os.getcwd(),title='Please select a directory')
    if len(dirname) > 0:
        print ("You chose %s" % dirname)
        return dirname
    else: 
        dirname = os.getcwd()
        print ("\nNo directory selected - initializing with %s \n" % os.getcwd())
        return dirname
edit.py 文件源码 项目:Circadia 作者: hooyah 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def menu_saveThemeAs(self):
        """ callback for saveAs menu item """

        newTheme = tkFileDialog.askdirectory(mustexist=True, initialdir=self.themeRootPath, title='Open Theme')
        if newTheme and os.path.isdir(newTheme):
            if os.path.isfile(newTheme+os.path.sep+'theme.json'):
                if not tkMessageBox.askyesno(title='Save theme', message='Theme exists. Overwrite?'):
                    return
            self.saveTheme(newTheme)
pymod_main.py 文件源码 项目:pymod 作者: pymodproject 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def choose_psiblast_db_dir(self):
        """
        Called when users want to manually choose a BLAST sequence database folder on their system.
        """
        current_path = self.blast_plus["database_dir_path"].get_value()
        new_path = None
        # Lets users choose a new path.
        new_path = askdirectory(title = "Search for a BLAST database directory", initialdir=current_path, mustexist = True, parent = self.blast_window)
        if new_path:
            if pmos.verify_valid_blast_dbdir(new_path):
                prefix = pmos.get_blast_database_prefix(new_path)
                # Updates the label with the new prefix name.
                self.choose_path_label.configure(text=prefix)
                self.list_of_databases_directories[0]["full-path"] = new_path
            else:
                self.choose_path_label.configure(text="None")
                self.list_of_databases_directories[0]["full-path"] = None
                title = "Selection Error"
                message = "The directory you specified does not seem to contain a valid set of sequence database files."
                self.show_error_message(title, message, parent_window = self.blast_window, refresh=False)
        # Selects the 'browse' button once users click on it.
        self.psiblast_database_rds.setvalue("browse")
fileintegrity.py 文件源码 项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def opendirectory():
    try:
        entry.delete(0, END)
        fileopen = tkFileDialog.askdirectory()
        entry.insert(END, fileopen)
    except:
        textbox.insert(END, "There was an error opening ")
        textbox.insert(END, fileopen)
        textbox.insert(END, "\n")
ximaexport-gui.py 文件源码 项目:XimaExport 作者: ryankomodo 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def openDir(self):
        self.out_entry.delete(0,tk.END)
        dirname=askdirectory()
        self.out_entry.insert(tk.END,dirname)
        if len(dirname)>0:
            #print('Output folder: %s' %dirname)
            printch('?:')
        print('   '+dirname)
            self.hasout=True
            self.checkReady()
androidtool_support.py 文件源码 项目:androidtool 作者: oicebot 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def browse_dir():
    print('androidtool_support.browse_dir')
    global file_path
    global files_list
    new_dir = tkFileDialog.askdirectory()
    #print(new_dir)
    if new_dir:
        file_path = new_dir
        os.walk(file_path)
        refresh_list(1)
GUI.py 文件源码 项目:Scoary 作者: AdmiralenOla 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def BrowseButtonClickOutput(self):
        """
        Browse button for choosing output dir
        """
        mydir = tkFileDialog.askdirectory(mustexist=True)
        self.Outputdir.set(mydir)
IDT_group_toolbox.py 文件源码 项目:Tweezer_design 作者: AntoineRiaud 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def Create_group():
    Tk().withdraw()
    IDT_group = {'IDT': []}
    IDT_group_dir = tkFileDialog.askdirectory(title = 'Project_filename')
    IDT_group['IDT_group_dir'] = IDT_group_dir
    return IDT_group
heartbreaker.py 文件源码 项目:heartbreaker 作者: lokori 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def selectDirectory(self,widget):
        if widget == self.sampledir:
            self.sampledir.textfield.config(state='enabled')
            self.inputfile.textfield.config(state='disabled')
        dirname = StringVar()
        dirname = askdirectory()
        if dirname:
            widget.textfield.delete(0,END)
            widget.textfield.insert(0,dirname)
            if len(dirname) > 40:
                widget.textfield.config(width = len(dirname))
GUI.py 文件源码 项目:sendobox 作者: sendobox 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_download_path():
    global download_path
    download_path = tkFileDialog.askdirectory()
    textbox_download_path.insert(INSERT, download_path)
GUI.py 文件源码 项目:sendobox 作者: sendobox 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def get_image_path():
    image_path = tkFileDialog.askdirectory()
    textbox_image_path.insert(INSERT, image_path)
main.py 文件源码 项目:aurora-sdk-win 作者: nanoleaf 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def get_plugin_dir(self):
        self.plugin_dir_path.set(tkFileDialog.askdirectory())
emulator.py 文件源码 项目:wireless-network-reproduction 作者: FinalTheory 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def load_dump_pos(self):
        dir_name, file_name = os.path.split(__file__)
        dir_name = os.path.join(dir_name, 'examples')
        dir_path = askdirectory(title='Choose dump position',
                                initialdir=dir_name)
        self.dump_pos.set(dir_path)
easygui.py 文件源码 项目:rapidpythonprogramming 作者: thecount12 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def diropenbox(msg=None
    , title=None
    , default=None
    ):
    """
    A dialog to get a directory name.
    Note that the msg argument, if specified, is ignored.

    Returns the name of a directory, or None if user chose to cancel.

    If the "default" argument specifies a directory name, and that
    directory exists, then the dialog box will start with that directory.
    """
    title=getFileDialogTitle(msg,title)      
    boxRoot = Tk()
    boxRoot.withdraw()
    if not default: default = None
    f = tk_FileDialog.askdirectory(
          parent=boxRoot
        , title=title
        , initialdir=default
        , initialfile=None
        )          
    boxRoot.destroy()     
    if not f: return None
    return os.path.normpath(f)



#-------------------------------------------------------------------
# getFileDialogTitle
#-------------------------------------------------------------------
gui_support.py 文件源码 项目:pkgdecrypt-frontend 作者: SilicaAndPina 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def output():
    global outputFolder
    outputFolder = tkFileDialog.askdirectory(title='Output Folder')
    sys.stdout.flush()
pymod_main.py 文件源码 项目:pymod 作者: pymodproject 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def pymod_directory_browse_state(self):
        current_path = self.pymod_dir_window_main_entry.get()
        # Lets users choose a new path.
        new_path = askdirectory(title = "Select a folder in which to build the 'PyMod Directory'",
                                initialdir=current_path, mustexist = True, parent = self.pymod_dir_window)
        # Updates the text in the Entry with the new path name.
        if new_path:
            self.pymod_dir_window_main_entry.delete(0, END)
            self.pymod_dir_window_main_entry.insert(0, new_path)
gui.py 文件源码 项目:FunKii-UI 作者: dojafoja 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_output_directory(self):
        out_dir=filedialog.askdirectory()
        self.out_dir_box.delete('0',tk.END)
        self.out_dir_box.insert('end',out_dir)
guiClass.py 文件源码 项目:Video-Downloader 作者: EvilCult 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __chooseCfgFolder (self) :
        path = tkFileDialog.askdirectory(initialdir="/",title='??????')
        self.filePath.set(path.strip())
appjar.py 文件源码 项目:BeachedWhale 作者: southpaw5271 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def directoryBox(self, title=None, dirName=None):
        self.topLevel.update_idletasks()
        options = {}
        options['initialdir'] = dirName
        options['title'] = title
        options['mustexist'] = False
        fileName = filedialog.askdirectory(**options)
        if fileName == "":
            return None
        else:
            return fileName
gui_widgets.py 文件源码 项目:SVPV 作者: VCCRI 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def asksaveasfilename(self):
        if not self.parent.filename:
            self.parent.set_info_box(message='Error: No figure has been created yet.')
        else:
            file_options = {}
            file_options['initialdir'] = self.parent.par.run.out_dir
            file_options['initialfile'] = re.sub('/.+/', '', self.parent.filename)
            file_options['filetypes'] = [('pdf files', '.pdf')]
            file_options['parent'] = self.parent
            file_options['title'] = 'save figure as'
            filename = tkFileDialog.askdirectory(**file_options)
            if filename:
                copyfile(self.parent.filename, filename)
gui.py 文件源码 项目:SVPV 作者: VCCRI 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def set_plot_all_dir(self):
        dir_options = {}
        dir_options['initialdir'] = self.par.run.out_dir
        dir_options['parent'] = self
        dir_options['title'] = 'select existing or type new directory'
        dir_options['mustexist'] = False
        path = tkFileDialog.askdirectory(**dir_options)
        if path == '':
            return None
        else:
            return path
ListPanel.py 文件源码 项目:Python-Media-Player 作者: surajsinghbisht054 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def ask_for_directory(self):
            path=tkFileDialog.askdirectory(title='Select Directory For Playlist')
            if path:
                    self.directory.set(path)
                    print (path)
                    return self.update_list_box_songs(dirs=path)
menotexport-gui.py 文件源码 项目:Menotexport 作者: Xunius 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def openDir(self):
        self.out_entry.delete(0,tk.END)
        dirname=askdirectory()
        self.out_entry.insert(tk.END,dirname)
        if len(dirname)>0:
            print('# <Menotexport>: Output folder: %s' %dirname)
            self.hasout=True
            self.checkReady()
gui.py 文件源码 项目:cms-dl 作者: nikhil-97 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def askdir(self):
        # global directory
        Gui.directory=tkFileDialog.askdirectory(parent=root, mustexist=True)
        print "askdir"
        #if directory:
        #   self.directory_var.set(directory)
Page3_functions.py 文件源码 项目:pyry3d_chimera_extension 作者: mdobrychlop 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def ig_choose_output_folder(self, parent, entry):
        outpath = tkFileDialog.askdirectory(
            parent=parent, initialdir="/", title="Choose output folder")
        entry.setvalue(outpath)
        entry.configure(entry_state="disabled")
        # outpath=outpath+"/input"
        return outpath
gui.py 文件源码 项目:pyry3d_chimera_extension 作者: mdobrychlop 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def clust_input_set(self):
        path = tkFileDialog.askdirectory(
                parent=self.page5,
                initialdir=self.initialdir,
                title="Choose input folder"
                )
        self.p6_input_entry.setvalue(path)
        self.save_path(path)
gui.py 文件源码 项目:pyry3d_chimera_extension 作者: mdobrychlop 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def clust_out_set(self):
        path = tkFileDialog.askdirectory(
            parent=self.page5,
            initialdir=self.initialdir,
            title="Choose output folder"
            )
        self.p6_output_entry.setvalue(path)
        self.save_path(path)
gui.py 文件源码 项目:pyry3d_chimera_extension 作者: mdobrychlop 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def ranking_input_set(self):
        path = tkFileDialog.askdirectory(
                parent=self.page5,
                initialdir=self.initialdir,
                title="Choose input folder"
                )
        self.p5_input_entry.setvalue(path)
        self.save_path(path)


问题


面经


文章

微信
公众号

扫码关注公众号