-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResultsNote.py
More file actions
77 lines (63 loc) · 1.97 KB
/
Copy pathResultsNote.py
File metadata and controls
77 lines (63 loc) · 1.97 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import tkinter as tk
import tkinter.font as tkFont
class Note(tk.Toplevel):
def __init__(self, parent, text: str = ""):
tk.Toplevel.__init__(self, parent)
self.controller = parent
self.text = text
x = 600
y = 360
self.geometry("{}x{}".format(x, y))
self.font = tkFont.Font(size=14)
self.font_btn = tkFont.Font(size=16)
self.pack_propagate(False)
self.txt_note = tk.Text(
self,
width=60,
height=4,
wrap=tk.WORD,
font=self.font
)
self.btn_increase_font_size = tk.Button(
self,
text="A",
fg="white",
bg="blue",
font=self.font_btn,
command=lambda: self.increase_font_size()
)
self.btn_decrease_font_size = tk.Button(
self,
text="a",
fg="white",
bg="blue",
font=self.font_btn,
command=lambda: self.decreate_font_size()
)
self.btn_confirm = tk.Button(
self,
text="Spremi",
fg="black",
bg="lime",
width=10,
font=self.font_btn,
command=lambda: self.confirm_and_exit()
)
self.txt_note.pack(side="top", expand=True, fill="both")
self.btn_decrease_font_size.pack(side="left")
self.btn_increase_font_size.pack(side="left")
self.btn_confirm.pack(side="right")
self.txt_note.insert("1.0", self.text)
self.protocol("WM_DELETE_WINDOW", self.user_exit)
def decreate_font_size(self):
self.font["size"] = self.font["size"] - 1
def increase_font_size(self):
self.font["size"] = self.font["size"] + 1
def user_exit(self):
self.text = None
self.destroy()
def confirm_and_exit(self):
text = self.txt_note.get("1.0", tk.END)
text = text[:-1]
self.text = text
self.destroy()