We can see on the Internet that wxpython is installed and Python 2.7.3 is available.
# !usr/bin/env python 2.7.3
# coding: utf-8
# filename: notepad.py
from Tkinter import *
from ScrolledText import *
import tkMessageBox
from tkFileDialog import *
import fileinput
T1=[]
Root=None
Def die ():
Sys.exit (0)
Def about ():
tkMessageBox.showinfo("Tkeditor","V1.0\n"
"written in 2012\n"
"writer:Test")
class editor:
def __init__(self,rt):
If rt==None:
Self.t=Tk ()
Else:
self.t=Toplevel(rt)
self.t.title("Tkeditor %d"%len(t1))
self.bar=Menu(rt)
self.filem=Menu(self.bar)
Self.filem.add_command (label = "open", command = self. OpenFile)
Self.filem.add_command (label = "new", command = neweditor)
Self.filem.add_command (label = "save", command = self. Savefile)
Self.filem.add_command (label = "close", command = self. Close)
self.filem.add_separator()
Self.filem.add_command (label = "exit", command = die)
self.helpm=Menu(self.bar)
Self.helpm.add_command (label = "about", command = about)
Self.bar.add ˊ cascade (label = "file", menu = self. Filem)
Self. Bar. Add ˊ cascade (label = "help", menu = self. Helpm)
self.t.config(menu=self.bar)
self.f=Frame(self.t,width=512)
self.f.pack(expand=1,fill=BOTH)
self.st=ScrolledText(self.f,background="white")
self.st.pack(side=LEFT,fill=BOTH,expand=1)
def close(self):
self.t.destroy()
def openfile(self):
P1=END
oname=askopenfilename(filetypes=[("Python file","*.*")])
If oname:
for line in fileinput.input(oname):
self.st.insert(p1,line)
self.t.title(oname)
def savefile(self):
sname=asksaveasfilename()
If sname:
ofp=open(sname,"w")
ofp.write(self.st.get(1.0,END))
Ofp.flush ()
Ofp.close ()
self.t.title(sname)
def neweditor():
Global root
t1.append(editor(root))
if __name__=="__main__":
Root=None
t1.append(editor(root))
Root=t1[0].t
root.mainloop()