On 22 Dec 2005 12:42:36 -0800, "planetthoughtful" <[EMAIL PROTECTED]> wrote:
> >Bengt Richter wrote: >> On 22 Dec 2005 08:55:17 -0800, "planetthoughtful" <[EMAIL PROTECTED]> wrote: >> > >> >I would like to include the ability to edit an existing value (drawn >> >from an SQLite table) using a DOS console Python app, but my gut >> >feeling from reading what I can find about raw_input() is that it only >> >allows you to provide a prompt, not a default value as well. >> > >> What's wrong with showing the default in the prompt itself? The thing is >> what user input in response should signify the default? E.g., maybe a single >> period by itself could mean "use the default" and nothing could mean "no >> change" >> and other input would be a new value. > >Hi Bengt, > >I think that would be a great solution if the value being 'edited' was >relatively short, or numeric, etc. But the values I want to 'edit' can >be several hundred characters long (ie they're text fields containing >todo notes), and using your method, I'd either accept the existing >value, or have to retype the text for that record. I think I mislead >people when I used the word 'default' -- I meant in the sense of being >able to edit the existing value, so that value, out of each record, >would be presented as the 'default', available for editing. > >Sorry for the confusion. > If you want to edit text, maybe the best thing is a text editor? Why not write it into a temp file and start the user's favorite editor on it, and when done, read the file back into python and delete the temp. Maybe check whether any changes actually happened before updating the DB. os.popen{2,3,4} and tempfile module might help. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list