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

Python tkFileDialog.askdirectory函数代码示例

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

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



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

示例1: getPath

def getPath():
    root = Tk()
    root.withdraw()
    InputPath = askdirectory(title="Choose Converting Picture Input Path")
    OutputPath = askdirectory(title="Choose Converting Picture Output Path")
    root.destroy()
    return InputPath, OutputPath
开发者ID:XinningShen,项目名称:Fisheye_Camera_Calibration,代码行数:7,代码来源:AdjustPicWithCalibratedCoefficient.py


示例2: askdirectory

  def askdirectory(self):

    """Returns a selected directoryname."""

    print(tkFileDialog.askdirectory(**self.dir_opt))

    return tkFileDialog.askdirectory(**self.dir_opt)
开发者ID:HTM-ell,项目名称:FullStacksProject1,代码行数:7,代码来源:TkinterExample.py


示例3: getPaths

def getPaths():
    global pathFirst
    global pathSecond
    root = tk.Tk()
    root.withdraw()
    pathFirst = tkfd.askdirectory(title="Select First Folder Path")
    pathSecond = tkfd.askdirectory(title="Select Second Folder Path")
开发者ID:mfscannell,项目名称:FileManager,代码行数:7,代码来源:SyncFiles.py


示例4: Extract_frame

def Extract_frame():
    print("Choose video file....")
    fname = askopenfilename(initialdir = '/home/andyc/Videos/')
    print("where do you want to save?(choose folder)\n")
    savepath = askdirectory(initialdir = '/home/andyc/image/')
    while savepath == '':
        print("wrong folder!!\n")
        print("where do you want to save?(choose folder)\n")
        savepath = askdirectory(initialdir = '/home/andyc/image/')
    savepath = savepath+'/'
 
    video = cv2.VideoCapture(fname)
    if video.isOpened():
        rval,frame = video.read()
    else:
         rval = False
    idx = 0
    while rval:
          print("Extracting {0} frame".format(idx)) 
          rval,frame = video.read()
          name = savepath+str(idx).zfill(6)+'.jpg'
          if rval:
             cv2.imwrite(name,frame)
          idx = idx+1
    video.release()
    return savepath
开发者ID:dawnknight,项目名称:traffic_analysis,代码行数:26,代码来源:light_comb.py


示例5: getMayaDir

 def getMayaDir(self):
     if self.plateform == "darwin":
         dir=self.sharedDirectory+"/Autodesk/maya/2011/plug-ins/"
         if not os.path.exists(dir):
             x = askdirectory(initialdir=self.progDirectory, title="where is MAYA2011 plugin directory")
             dir = x                
         self.dir[3].set(dir)
         self.softdir[3] = dir
     elif self.plateform == "win32":
         dir=self.findDirectoryFrom("Maya2011",self.progDirectory+os.sep+"Autodesk"+os.sep)
         if len(dir) ==0 :
             x = askdirectory(initialdir=self.progDirectory, title="where is MAYA2011 bin/plugins directory")
             dir = x
             self.dir[3].set(dir)
             self.softdir[3] = dir                
         elif len(dir) == 1 :
             dir = dir[0]
             dir = dir +os.sep+"bin"+os.sep+"plug-ins"
             self.dir[3].set(dir)
             self.softdir[3] = dir
         else :
             self.chooseDirectory(3,dir)
     elif self.automaticSearch and dir is None:
         dir=self.findDirectory("maya2011",self.rootDirectory)
         dir = dir.replace(" ","\ ")
         self.dir[3].set(dir)
         self.softdir[3] = dir
开发者ID:MolecularFlipbook,项目名称:FlipbookApp,代码行数:27,代码来源:install_plugin.py


示例6: main

def main():
    root=Tk()
    root.withdraw() #Get rid of visible default TK base window
    newPath = tkFileDialog.askdirectory(initialdir='/', title='Select NEW VSDX Documents Folder')
    oldPath = tkFileDialog.askdirectory(initialdir='/', title='Select OLD VSDX Documents Folder')
    destPath = tkFileDialog.askdirectory(initialdir='/', title='Select Comparison Results Folder')

    oldFiles = getOldFiles(oldPath)
    newFiles = getNewFiles(newPath)

    # Open report.txt file
    rptFilename = destPath + '/' + 'ComparisonReport_' + str(date.today()) + '.txt'

    with open(rptFilename, 'w') as rptFile:
        rptFile.write('Comparison Report for %s\n\n' % str(date.today()))
        rptFile.write('Total OLD Files: %d\n' % len(oldFiles))
        rptFile.write('Total NEW Files: %d\n\n' % len(newFiles))

        # Compare the files
        for newFile in newFiles:
            if newFile in oldFiles:
                compareFiles(oldPath, newPath, destPath, newFile)
            else:
                rptFile.write('New file added: %s\n' % newFile)

        rptFile.write('\n\n')

        for oldFile in oldFiles:
            if oldFile not in newFiles:
                rptFile.write('Old file dropped: %s\n' % oldFile)
开发者ID:troygt,项目名称:VisioCompare,代码行数:30,代码来源:visioVSDXCompare.py


示例7: askdirectory

 def askdirectory(self,button_name):
     #gets the directory name
     if button_name=='proj':
         self.dirname_data.set(tkFileDialog.askdirectory())
     elif button_name=='beam':
         self.dirname_lf.set(tkFileDialog.askdirectory())
     elif button_name=='dark':
         self.dirname_dc.set(tkFileDialog.askdirectory())
开发者ID:sseebbbbee,项目名称:reconstruction-software-STH-micro-CT,代码行数:8,代码来源:GUI.py


示例8: getlocation

 def getlocation(self):
     if os.path.exists(self.location):
         l = tkFileDialog.askdirectory(initialdir=self.location, mustexist=True)
     else:
         l = tkFileDialog.askdirectory(mustexist=True)
     if os.path.exists(l):
         self.location = l
     self.entryboxes['Location'].delete(0,END)
     self.entryboxes['Location'].insert(0, self.location)
开发者ID:CLPeters,项目名称:DeFFNetIzer,代码行数:9,代码来源:deffnet.py


示例9: gettemplate

 def gettemplate(self):
     if os.path.exists(self.templatepath):
         l = tkFileDialog.askdirectory(initialdir=self.templatepath, mustexist=True)
     else:
         l = tkFileDialog.askdirectory(mustexist=True)
     if os.path.exists(l):
         self.templatepath = l
     self.entryboxes['Template'].delete(0,END)
     self.entryboxes['Template'].insert(0, self.templatepath)
开发者ID:CLPeters,项目名称:DeFFNetIzer,代码行数:9,代码来源:deffnet.py


示例10: getDir

def getDir(initialDir=""):
    root = tk.Tk()
    root.withdraw()
    if(initialDir != ""):
        file_path = tkFileDialog.askdirectory(initialdir=initialDir)
    else:
        file_path = tkFileDialog.askdirectory()
    root.destroy()

    return file_path
开发者ID:SamuelLBau,项目名称:HE_GUI,代码行数:10,代码来源:simpleDialogs.py


示例11: _ask_path_to_directory

 def _ask_path_to_directory(self):
     """ Ask a path to the destination directory. If a dir has been already specified,
     open the choice window showing this dir. """
     if not self.homeDir:
         path = askdirectory(**_DialogueLabels.save_output_directory_choice)
     else:
         path = askdirectory(initialdir = self.homeDir, **_DialogueLabels.save_output_directory_choice)
     if path:
         self.homeDir = path
     return path
开发者ID:sleepofnodreaming,项目名称:ruscorporaXML,代码行数:10,代码来源:tabgui.py


示例12: AskDirectory

    def AskDirectory(self, title='Choose Directory', initialdir="."):
        """Run pop-up menu for user to select directory."""
    #    This is not an error
    # pylint: disable=E1101

        if sys.version_info < (3,):
            dirname = tkFileDialog.askdirectory(parent=self.master,
                                             initialdir=initialdir,title=title)
        else:
            dirname = tkFileDialog.askdirectory(parent=self.master,
                                             initialdir=initialdir,title=title)
        return dirname # <-- string
开发者ID:sonofeft,项目名称:Tk_Nosy,代码行数:12,代码来源:main_gui.py


示例13: ExpBrowse

        def ExpBrowse():
            if not self.hasBrowsed:
                dir = tkFileDialog.askdirectory(title='Choose a directory',
                                                initialdir=self.initBrowseDir)
                self.hasBrowsed = True
            else:
                dir = tkFileDialog.askdirectory(title='Choose a directory')

            if not dir:
                return None
            #self.addExp_Entry.setvalue(dir)
            self.AddExperiment(dir)
开发者ID:BreakawayLabs,项目名称:MOM4p1,代码行数:12,代码来源:fbExpBrowser.py


示例14: getFolders

    def getFolders(self):
        self.input_dir = tkFileDialog.askdirectory(
            parent=self.parent, title="Please select an input directory for 2dx_automator"
        )
        if len(self.input_dir) == 0:
            raise SystemExit("No input directory selected")

        self.output_dir = tkFileDialog.askdirectory(
            parent=self.parent, title="Please select an output directory for 2dx_automator"
        )
        if len(self.output_dir) == 0:
            raise SystemExit("No output directory selected")
开发者ID:C-CINA,项目名称:2dx,代码行数:12,代码来源:2dx_automator.py


示例15: extracter

def extracter(spreadsheet, column_name):
	"""
	The extracter moves files.
	Arguments input_folder and output_folder are set through GUI. 
	Based on the values in the column called column_name in the spreadsheet, files are copied from input_folder to output_folder. 
	Here, these are the gilbert_numbers in the spreadsheet fed from main(). 
	The are matched to the file names. 
	Each gilber_number gets its own directory in the output_folder. 
	output_folder should be empty, at least not contain the same gilbert_numbers already.
	Also copies all speaker files from input_folder to output_folder. 
	"""
 	print header, "Running the extracter."
 	root=Tkinter.Tk()
	root.withdraw()
	root.update()
 	input_folder=tkFileDialog.askdirectory(title="Inputfolder: Please choose a directory that contains your corpus files")
 	root=Tkinter.Tk()
	root.withdraw()
	root.update()
 	output_folder=tkFileDialog.askdirectory(title="Outputfolder: Please choose a directory to copy files into")
 	print header, "Copying files from '{}' to '{}'.".format(input_folder, output_folder)
 	#collecting input files
 	inputfiles=[]
	print "Locating files."	
	for dirpath, subdirs, files in os.walk(input_folder):
		for f in files:
			inputfiles.append(os.path.join(dirpath, f))
			if len(inputfiles) in [1000,2000,4000,8000,1600,24000]:
				print "{} files processed, still working.".format(len(inputfiles))
	print "Found {} files.".format(len(inputfiles))
 	#read from spreadsheet
 	# with open(spreadsheet, "r") as spreadsheet:
#  		spreadsheet=pandas.read_csv(spreadsheet, encoding="utf-8")
 	numbers_to_be_extracted= spreadsheet[column_name].unique()
 	print header, "Gilbert numbers to be extracted:"
 	print ",".join([unicode(i) for i in numbers_to_be_extracted])
	#copying speaker files
	print header, "Copying speaker files."
	speakerfiles=[f for f in inputfiles if re.match(".*\.txt", os.path.split(f)[1])]
	os.mkdir(os.path.join(output_folder, "speakers"))
	for s in speakerfiles:
		shutil.copy2(s, os.path.join(output_folder, "speakers"))
 	#finding relevant input files
 	result=[]
	for number in numbers_to_be_extracted:
		print "Processing {}, creating folder '{}'.".format(number, number)
		os.mkdir(os.path.join(output_folder, unicode(number)))
		regex="(\d+)-(\d+)-(\d+)-"+number.astype('U')+"-(\D+)\.wav"
  		findings= [f for f in inputfiles if re.match(regex, os.path.split(f)[1])]
  		result= result+findings
  		for find in findings:
  			shutil.copy2(find, os.path.join(output_folder, unicode(number), os.path.split(find)[1]))	
  	print header, "{} files have been copied to {}.".format(len(result), output_folder)
开发者ID:patrickschu,项目名称:tgdp,代码行数:53,代码来源:gilbertfinder_original.py


示例16: __init__

 def __init__(self):
     """Constructor"""
     
     self.workspace = arcpy.env.workspace = tkFileDialog.askdirectory(initialdir = INITDIR, parent=tkRoot, title = 'Choose workspace (ArcPy)', mustexist = True)
     arcpy.env.scratchWorkspace = tkFileDialog.askdirectory(initialdir = INITDIR+"\scratchworkspace", parent=tkRoot, title = 'Choose scratch workspace (ArcPy)', mustexist = True)
             
     #Arcpy specific
     arcpy.CheckOutExtension("spatial") #Load sa license
             
     arcpy.env.overwriteOutput = True #Enable overwrite existing data
     arcpy.env.outputCoordinateSystem = OUTPUT_COORDINATESYSTEM #"Coordinate Systems/Projected Coordinate Systems/UTM/WGS 1984/Northern Hemisphere/WGS 1984 UTM Zone 43N.prj"
     
     self.pArcPyTools = ArcPyTools() #Init of own tool class
开发者ID:niholzer,项目名称:glacier_tools,代码行数:13,代码来源:image_processing_14052013.py


示例17: pathOpen

def pathOpen(option=0):
    if option is 0:
        userpath.set(tkFileDialog.askdirectory(parent=root))
        cfg.userPath = userpath.get()
    elif option is 1:
        gtpath.set(tkFileDialog.askdirectory(parent=root))
        if os.path.isfile(os.path.join(gtpath.get(), "data.mat")):
            cfg.gtPath = gtpath.get()
            cfg.loadGT()
            tempo.set(cfg.tempo)
            duration.set(cfg.duration)
        else:
            tkMessageBox.showinfo("ERROR", "Missing data file.  Please choose a different folder.")
开发者ID:shahrodkh,项目名称:seniorDesign,代码行数:13,代码来源:mainGUI.py


示例18: askInstallPrefix

 def askInstallPrefix(self):
     """
     command for search button
     """
     initDir=self.installP.get()
     newPrefix=""
     if os.path.exists(initDir):
         newPrefix=tkFileDialog.askdirectory(parent=self,initialdir=initDir,mustexist=1)
     else:
         newPrefix=tkFileDialog.askdirectory(parent=self,mustexist=1)                
     if newPrefix:
         self.installP.delete(0, Tkinter.END)
         self.installP.insert(0, newPrefix)
开发者ID:leo-editor,项目名称:leo-editor-contrib,代码行数:13,代码来源:GatoSystemConfiguration.py


示例19: getFolders

	def getFolders(self):
                self.input_dir = tkFileDialog.askdirectory(parent=self.parent, title="Input directory for movies from the DED camera, e.g. /run/user/1001/gvfs/ftp:host=192.168.210.1.port=8021/...")
                if len(self.input_dir)==0:
                        raise SystemExit("No input directory selected")

                self.output_dir = tkFileDialog.askdirectory(parent=self.parent, title="Output directory for averages and other files, e.g. /mnt/cina-qnap01/.../DC_averages")
                if len(self.output_dir)==0:
                        raise SystemExit("No averages output directory selected")

                stack_dir = tkFileDialog.askdirectory(parent=self.parent, title="Output directory for aligned stacks, e.g. /mnt/cina-qnap01/.../DC_stacks")
                if len(stack_dir)==0:
                        raise SystemExit("No stack-output directory selected")
                self.export_location_stack = stack_dir
开发者ID:C-CINA,项目名称:2dx,代码行数:13,代码来源:motioncorrect_gui.py


示例20: file_select

   def file_select(self, file_type):
      #file_type is internal, uses string ints (goes in order of layout in __init__
      if file_type == '0':
	#this is bwa_directory
	self.bwa_directory_path.config(state = NORMAL)
	self.bwa_directory_path.delete(1.0, END)
	file_name = tkfd.askdirectory(parent=self, title='Select BWA Aligner directory')
	self.bwa_directory_path.insert(INSERT, file_name)
	self.bwa_directory_path.config(state = DISABLED)
	
	with open('paths.txt', 'r') as file:
	  lines = file.readlines()
	lines[0] = file_name + '\n'
	with open('paths.txt', 'w') as file:
	  file.writelines(lines)
	
      elif file_type=='1':
	#this is picard_directory
	self.picard_directory_path.config(state = NORMAL)
	self.picard_directory_path.delete(1.0, END)
	file_name = tkfd.askdirectory(parent=self, title='Select Picard Tools directory')
	self.picard_directory_path.insert(INSERT, file_name)
	self.picard_directory_path.config(state = DISABLED)
	
	with open('paths.txt', 'r') as file:
	  lines = file.readlines()
	lines[1] = file_name + '\n'
	with open('paths.txt', 'w') as file:
	  file.writelines(lines)
			 
      elif file_type=='2':
	#this is samtools_directory
	self.samtools_directory_path.config(state = NORMAL)
	self.samtools_directory_path.delete(1.0, END)
	file_name = tkfd.askdirectory(parent=self, title='Select SamTools directory')
	self.samtools_directory_path.insert(INSERT, file_name)
	self.samtools_directory_path.config(state = DISABLED)
	
	with open('paths.txt', 'r') as file:
	  lines = file.readlines()
	lines[2] = file_name + '\n'
	with open('paths.txt', 'w') as file:
	  file.writelines(lines)
	  
      else:
	#this is the output directoyr
	self.out_dir_path.config(state = NORMAL)
	self.out_dir_path.delete(1.0, END)
	file_name = tkfd.askdirectory(parent=self, title='Select output directory')
	self.out_dir_path.insert(INSERT, file_name)
	self.out_dir_path.config(state = DISABLED)
开发者ID:dlawre14,项目名称:gatk-automator,代码行数:51,代码来源:gatk_main_app.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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