Every line of 'tkinter filedialog' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
38 def ask_file(title): 39 root = Tk() 40 filename = filedialog.askopenfilename(parent=root, title=title) 41 root.destroy() 42 return filename
123 def tix_filedialog(self, dlgclass=None): 124 """Returns the file selection dialog that may be shared among 125 different calls from this application. This command will create a 126 file selection dialog widget when it is called the first time. This 127 dialog will be returned by all subsequent calls to tix_filedialog. 128 An optional dlgclass parameter can be passed to specified what type 129 of file selection dialog widget is desired. Possible options are 130 tix FileSelectDialog or tixExFileSelectDialog. 131 """ 132 if dlgclass is not None: 133 return self.tk.call('tix', 'filedialog', dlgclass) 134 else: 135 return self.tk.call('tix', 'filedialog')
850 def file_dialog(self): 851 # FIXME: return python object 852 pass
16 def file_save_dialog(title): 17 dialog_style = wx.FD_SAVE 18 19 dialog = wx.FileDialog( 20 None, message=title, 21 defaultDir=os.getcwd(), 22 defaultFile='', style=dialog_style) 23 24 return dialog
64 def file_dialog(message, wildcard, style, ok_handler, default_file=''): 65 last_opened_dir_file = os.path.join(dirs.CACHE_DIR, 'last_opened_dir') 66 67 last_opened_dir = None 68 69 if os.path.exists(last_opened_dir_file): 70 with open(last_opened_dir_file, 'r') as fp: 71 last_opened_dir = fp.read().strip() 72 73 if last_opened_dir is None or len(last_opened_dir) == 0: 74 last_opened_dir = os.path.expanduser('~') 75 76 dlg = wx.FileDialog( 77 None, message, last_opened_dir, default_file, wildcard, style) 78 79 try: 80 if dlg.ShowModal() == wx.ID_OK: 81 last_opened_dir = dlg.GetDirectory() 82 83 path = os.path.join(dlg.GetDirectory(), dlg.GetFilename()) 84 ok_handler(dlg, path) 85 finally: 86 dlg.Destroy() 87 88 if not os.path.exists(dirs.CACHE_DIR): 89 os.makedirs(dirs.CACHE_DIR) 90 91 with open(last_opened_dir_file, 'w+') as fp: 92 fp.write(last_opened_dir)
132 def askopenfilenames(**options): 133 """Ask for multiple filenames to open 134 135 Returns a list of filenames or empty list if 136 cancel button selected 137 """ 138 options["multiple"]=1 139 return Open(**options).show()
356 @contextmanager 357 def askSaveAsFile(**kw): 358 file = filedialog.asksaveasfile(**kw) 359 try: 360 yield file 361 finally: 362 file.close()
24 def FileOpenDialog( message, wildcard, style=0, defaultDir=os.getcwd(), defaultFile='' ): 25 """Generic file open dialog.""" 26 style = style | wx.OPEN | wx.CHANGE_DIR 27 return FileDialog( message, wildcard, style, defaultDir, defaultFile )
510 def askdirectory(self, **args): 511 """Returns a user-selected directory name. Tries to return the 'initialdir' default if nothing selected """ 512 if args['initialDir'] and len(args['initialDir'])>0: 513 dirname = tkFileDialog.askdirectory(initialdir = args['initialDir'], **self.dir_opt) 514 else: 515 dirname = tkFileDialog.askdirectory(**self.dir_opt) 516 print dirname 517 print args 518 if not dirname: 519 print "no directory name given" 520 if args['initialDir']: 521 return args['initialDir'] 522 else: 523 return '' 524 else: 525 print dirname 526 return dirname
534 def asksavefile(self): 535 dir, base = self.defaultfilename("save") 536 if not self.savedialog: 537 self.savedialog = tkFileDialog.SaveAs(master=self.text, 538 filetypes=self.filetypes) 539 return self.savedialog.show(initialdir=dir, initialfile=base)