-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoteWindow.py
More file actions
62 lines (47 loc) · 1.5 KB
/
NoteWindow.py
File metadata and controls
62 lines (47 loc) · 1.5 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
import tkinter as tk
import tkinter.font as tkFont
class NoteWindow(tk.Toplevel):
def __init__(self, parent, text=""):
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.decrease_font_size()
)
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.txt_note.insert("1.0", self.text)
self.bind("<Escape>", self.close)
def close(self, event):
self.destroy()
def decrease_font_size(self):
self.font["size"] = self.font["size"] - 1
def increase_font_size(self):
self.font["size"] = self.font["size"] + 1