from tkinter import * from tkinter.filedialog import asksaveasfile from tkinter import filedialog ws = Tk() ws.geometry('200x200') ws.title("Python Guides") def save(): Files = [('All Files', '*.*'), ('Python Files', '*.py'), ('Text Document', '*.txt')] file = asksaveasfile(filetypes=Files, defaultextension=Files) def get_file_path(): global file_path1 file_path1 = filedialog.askopenfilename(title="Select A File", filetypes=( ("Python files", "*.png"), ("mp4", "*.mp4"), ("wmv", "*.wmv"), ("avi", "*.avi"))) l1 = Label(ws, text="File path: " + file_path1).pack() button = Button(ws, text='Save', command=lambda: save()) button.pack(side=TOP, pady=20) button = Button(ws, text="openfile", command=get_file_path).pack(pady=10) ws.mainloop()