Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Sep 25, 2020
Embed
What would you like to do?
def open_file():
"""Open a file for editing."""
filepath = askopenfilename(
filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
)
if not filepath:
return
txt_edit.delete("1.0", tk.END)
with open(filepath, "r") as input_file:
text = input_file.read()
txt_edit.insert(tk.END, text)
window.title(f"Thecleverprogrammer - {filepath}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment