File size: 819 Bytes
b75ee05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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()