def open_file_command(self, event=None): from tkinter import filedialog dialog = filedialog.LoadFileDialog(self.master) filename = dialog.go(key="load") if filename: import urllib self.context.load('file:' + urllib.pathname2url(filename))
def open_file(): root0 = Tk() root0.geometry("0x0+20+20") fd = filedialog.LoadFileDialog(root0) # 创建打开文件对话框 filename = fd.go("/home/tarena/桌面/网盘文件") print(filename) root0.mainloop()
def single_convert(self): """ 转换单个文件为json """ print('self', id(self)) fd = filedialog.LoadFileDialog(self) filename = fd.go() if filename: self.do_convert_base(filename) messagebox.showinfo("Excel To Json", "转换成功")
def on_browse_data(self): filename = filedialog.LoadFileDialog(self.root, title="Browse").go( pattern="*.csv", dir_or_file=os.path.expanduser("~")) if not filename: return self.data.delete("0.1", "end") self.data.insert("insert", filename) self.notify()
def gotofiledialog(self): """ show the Filedialog :return: """ self.filedialog = filedialog.LoadFileDialog(self) self.filepath = self.filedialog.go( key="go") # select a file and store the path if self.filepath is None: return else: self.update_data()
def vOpenIHXCB(self, event=None): oFD = FileDialog.LoadFileDialog(self.oAppSprog.master, title='Load IHX File') filename = oFD.go(dir_or_file='.', key='track', pattern='*.ihx') if filename == None: return if self.bOpenIhxFile(filename) == False: tkMessageBox.showerror('File Error !!', 'It is not a correct IHX file...') return self.vDisplayHexFile(filename) self.filename = filename return
def browse_command(self): from tkinter import filedialog fd = filedialog.LoadFileDialog(self.browse) filename = fd.go(self.entry.get(), key="load") if filename: self.set(filename)
def loadFile(): return fd.LoadFileDialog(window)