[Tutor] Building a simple text editor

wesley chun wescpy at gmail.com
Sat Oct 14 18:16:58 CEST 2006


> I am trying to build a simple text editor which has a couple of options of
> editing, displaying and saving the file.
> Now what I want to do is to allow teh user to keep entering the text unless
> he pressed ':q'.


reading of and writing of a text file is one of the examples i added
to "Core Python Programming".  in fact, these are the 1st two
applications that are presented to the reader to introduce them to
their first pieces of Python code to study.  in the application that
writes text files, the user types '.' to terminate the input and save
the file.  that can easily be changed to 'q'.

you don't need to buy the book if you don't wish... you can just get
to the source code.  it's available at the book's website (see
below)... just go to chapter 3.  (the server is down at the moment,
but should be back up soon.)

furthermore, in order to do what you suggest, e.g., make it work like
vim where it has two modes, edit and input, you will have to build
that into your application, plus have special keys to get you into
that mode as well as a key (e.g., ESC) to get you out.

good luck!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list