forked from namishkhanna/hacktoberfest2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotepad.py
58 lines (45 loc) · 1.4 KB
/
Notepad.py
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
from tkinter import *
from tkinter.messagebox import showinfo
def newfile():
pass
def openfile():
pass
def savefile():
pass
def exit():
root.destroy()
def cut():
textArea.event_generate(("<<Cut>>"))
def copy():
textArea.event_generate(("<<Copy>>"))
def paste():
textArea.event_generate(("<<Paste>>"))
def about():
showinfo("Notepad ","By Almas Dinani" )
root=Tk()
root.geometry("400x500")
root.title("Untitled - Notepad")
textArea = Text(root, font="lucida 13")
textArea.pack(expand=True, fill=BOTH)
menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="New", command=newfile)
filemenu.add_command(label="Open", command=openfile)
filemenu.add_command(label="Save", command=savefile)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=exit)
menubar.add_cascade(label="File",menu=filemenu)
editmenu = Menu(menubar,tearoff=0)
editmenu.add_command(label="Cut", command=cut)
editmenu.add_command(label="Copy", command=copy)
editmenu.add_command(label="Paste", command=paste)
menubar.add_cascade(label="Edit" ,menu=editmenu)
helpmenu = Menu(menubar,tearoff=0)
helpmenu.add_command(label="About Notepad",command=about)
menubar.add_cascade(label="Help" ,menu=helpmenu)
root.config(menu=menubar)
Scroll = Scrollbar(textArea)
Scroll.pack(side=RIGHT, fill=Y)
Scroll.config(command=textArea.yview)
textArea.config(yscrollcommand=Scroll.set)
root.mainloop()