def browseDestFile(self): filename = tkfd.asksaveasfilename(initialdir=self._convConfigHandler. readPlaneShiftScoresDefaultFldr(), filetypes=(("XML Files", "*.xml"), ("All Files", "*.*"))) self.endDestFile.delete(0, END) self.endDestFile.insert(0, filename)
def saveas(self): data = self.text.get(1.0, 'end-1c') self.original = data temp = self.filename self.filename = dialog.asksaveasfilename(parent=self.window, filetypes=[('Text', '*.txt')], title='Save as...') if self.filename == '': self.filename = temp self.window.title(self.filename + " - Andrea's Notepad") else: self.window.title(basename(self.file_ext()) + " - Andrea's Notepad") writer = open(self.file_ext(), 'w') writer.write(data) writer.close()
def getFileNameSave(title='Guardar', file_types=[['Archivos de Texto', '.txt'], ['Todos los Archivos', '.*']], init_dir=os.getcwd(), encima=True): if encima == True: root.wm_attributes('-topmost', True) else: root.wm_attributes('-topmost', False) f_name = filedialog.asksaveasfilename(title=title, initialdir=init_dir, filetypes=file_types) if not f_name == '': return f_name
def savePlaylist(): ''' #Attempt 1: But this makes a temporary .txt file, We want something more complex thefile = open('playlist.txt', 'w') for song in root.playlist: thefile.write("%s\n" % song) thefile.close() ''' #Attempt 2 #using import pickle #using Tkinter too root.playListFileO = filedialog.asksaveasfilename( title="Give a name to your playlist", filetypes=(("Python File", ".py"), ("Text File", ".txt")), initialdir="/") output = open(root.playListFileO, 'wb') pickle.dump(root.playlist, output, -1) output.close()
def savefile(self): self.save_name = asksaveasfilename(initialdir='C:\\Python31')
def SaveFile(): f = filedialog.asksaveasfilename( title='save file', initialdir='/home/syang/syang/practices/python_GUI_Tkinter', initialfile='hello.py') print(f)
def save(): self.shift_activated = False file_name = asksaveasfilename(defaultextension=".npy") if file_name is None or len(file_name) == 0: return np.save(file_name, self.layers, allow_pickle=False)
def analyzeData(): """ callback fcn: ask user for file, call parse funciton , save output """ filename = fd.askopenfilename() newFile = fd.asksaveasfilename(defaultextension='.csv') main(filename, newFile) print("DONE")