Im confused and I need to know how to read from a tkinter textbox in order to create a text editor. Also would it be possible to have certain words colorized as you type in words? I would like to make this into a code editor possibly. Any help would be greatly apreciated.
from Tkinter import *
import tkMessageBox
import EasyDialogs #a windows port of the mac module
import sys
def Exit():
sys.exit()
def Help():
tkMessageBox.showinfo("Help","Created by Erik Anderson")
def ask_save():
response = tkMessageBox.askyesno("Save?", "Would you like to save?")
if response == True:
File = EasyDialogs.AskFileForSave("Save File")
####################################
text = #This Is where i need the function
####################################
Filesave = open(File, 'w')
Filesave.write(text)
Filesave.close()
elif response == False:
pass
def new():
ask_save()
root = Tk()
menu = Menu(root)
text = Text(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="New", command=new)
filemenu.add_command(label="Open...", command=new)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=Exit)
helpmenu = Menu(menu)
menu.add_cascade(label="Help", menu=helpmenu)
helpmenu.add_command(label="About...", command=Help)
Textbox = Text(root)
Textbox.pack(side=LEFT)
root.mainloop()
thx in advance!
Erik Anderson