import pathlib import tkinter as tk MARKER = pathlib.Path(r"__MARKER__") READY = pathlib.Path(str(MARKER) + ".ready") root = tk.Tk() root.title("Document") root.geometry("420x230+120+120") root.configure(bg="#f5f6f8") title = tk.Label(root, text="Untitled document - unsaved changes", bg="#f5f6f8") title.place(x=20, y=18) tk.Label(root, text="File name", bg="#f5f6f8").place(x=20, y=70) entry = tk.Entry(root) entry.place(x=20, y=95, width=300, height=28) entry.insert(0, "report.txt") buttons = [] def chosen(): MARKER.write_text("Save") title.config(text="Saved to disk") for widget in buttons: widget.place_forget() buttons.append(tk.Button(root, text="Save", command=chosen)) buttons[0].place(x=20, y=155, width=110, height=40) root.update() READY.write_text("mapped") root.mainloop()