The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by keithvb]

I'd like to create a simple text editor.
My plan is to fill a 2-d list with characters.
I need to read one character at a time so I can decide if it is text, a tab, a
bs, a return, etc.

Any suggestions?

thanks,

Keith
import-bot (20211) [Avatar] Offline
#2
Re: Character based input
[Originally posted by daryl harms]

> I'd like to create a simple text editor.
> My plan is to fill a 2-d list with characters.
> I need to read one character at a time so I can decide if it is text, a tab, a
> bs, a return, etc.
>
> Any suggestions?
>
> thanks,
>
> Keith

Hi Keith,

For a basic way of doing this you might want to look at the "curses" module.
There is a nice article on it (written by David Mertz for the Charming Python
series)which can be found at:

http://www-106.ibm.com/developerworks/library/l-python6.html?dwzone=linux

A more powerful but more involved solution would be to base off of one of the
GUI toolkits such as Tkinter or wxPython.

The source code for Idle (i.e. found in Csmilieython20Toolsidle on my machine)
would probably be the best place I know of to start looking for a Tkinter
based solution. It does, however, do a fair bit more than what you may be
looking for and there will be a learning curve to understand it. But it has an
architecture that should allow you to pare down and/or add other
functionality.

Daryl