-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiary.py
More file actions
93 lines (75 loc) · 2.58 KB
/
Copy pathDiary.py
File metadata and controls
93 lines (75 loc) · 2.58 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from tkinter import *
from tkinter import filedialog
from tkinter.ttk import *
def submit():
input = text.get("1.0",END)
print(input)
def openFile():
file_path = filedialog.askopenfilename(initialdir="// Put your directory link here!",
title="File Explorer",
filetypes=(("Text files", "*.text"),
("All files", "*.*")))
file = open(file_path, 'r')
print(file.read())
file.close()
print("File opened!")
def saveFile():
file = filedialog.asksaveasfile(initialdir="// Put your directory link here!",
defaultextension='.txt',
filetypes=[
("Text file", ".txt"),
("HTML file", ".html"),
("All files", ".*"),
("Microsoft pdf document", ".pdf")
])
filetext = str(text.get(1000000, END))
file.write(filetext)
print("File saved!")
file.close()
def cut():
print("Cut some text!")
def copy():
print("Copied some text!")
def paste():
print("Pasted some text!")
def save():
print("Saved some text!")
window = Tk()
text = Text(window,
bg="White",
font=('Calibri', 15),
height=1000,
width=200,
padx=10,
pady=10,
fg="Blue")
text.pack()
menubar = Menu(window)
window.config(menu=menubar)
fileMenu = Menu(menubar, tearoff=0, font=("Bahnschrift", 10))
menubar.add_cascade(label="FILE", menu=fileMenu)
fileMenu.add_command(label="Open", command=openFile)
fileMenu.add_command(label="Save", command=saveFile)
fileMenu.add_separator()
fileMenu.add_command(label="Exit", command=quit)
editMenu = Menu(menubar, tearoff=0, font=("Elegant", 10))
menubar.add_cascade(label="EDIT", menu=editMenu)
editMenu.add_command(label="Cut", command=cut)
editMenu.add_command(label="Copy", command=copy)
editMenu.add_command(label="Paste", command=paste)
button1 = Button(text='save', command=saveFile)
button2 = Button(text='open', command=openFile)
button3 = Button(text='cut', command=cut)
button4 = Button(text='open', command=copy)
button5 = Button(text='open', command=paste)
button1.pack()
button2.pack()
button3.pack()
button4.pack()
button5.pack()
percent = StringVar()
text = StringVar()
window.geometry('1000x1000')
window.title('AFJ Diaries')
window.config(background='BLACK')
window.mainloop()