473,603 Members | 2,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asking the user a question and giving him a default answer he can edit

I'm trying to figure out the python readline module to see if it will
do this.

Basically, I've got a bunch of questions to ask a user, the vast
majority of which, the answer will only vary by the last few
characters. What I'd like to do is every time the user is asked a
question, give him the default answer as just whatever he answered last
time. But, I want him to be able to edit this default answer. And, the
editted answer is what I want to operate on inside my program.

raw_input() lets the user edit the prompt I send. But, internally, it
must ignore the backspace key or something. Because, it only returns
new letters that the user has typed in. Not anything that he has
backspaced over or deleted.

You can edit whatever you put out there with raw_input, but it's like
internally that function ignores the backspace key, and just returns
whatever new characters the user types.

Basically, I want to the user a line editor, with a default value
already populated.

Anybody know how to do something like this?

I've been playing around with doing it in bash, figuring I can use
popen to spawn the process if I can figure it out, but haven't figured
it out yet.

Jul 31 '05 #1
1 1335
"levander" <le******@minds pring.com> writes:
Basically, I've got a bunch of questions to ask a user, the vast
majority of which, the answer will only vary by the last few
characters. What I'd like to do is every time the user is asked a
question, give him the default answer as just whatever he answered last
time. But, I want him to be able to edit this default answer. And, the
editted answer is what I want to operate on inside my program.
Something like this?

/>> def f():
|.. readline.set_st artup_hook(lamb da :readline.inser t_text('aaa'))
|.. return raw_input()
\__
Basically, I want to the user a line editor, with a default value
already populated.


Or you could use my pyrepl package (see google for that).

Cheers,
mwh

--
In case you're not a computer person, I should probably point out
that "Real Soon Now" is a technical term meaning "sometime before
the heat-death of the universe, maybe".
-- Scott Fahlman <se*@cs.cmu.edu >
Jul 31 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1750
by: Deniz Bahar | last post by:
Hi, My english is not top notch and I am trying to understand what K&R2 Ex 5-11 is asking for (pg 118). It says: Modify the programs entab and detab (which I completed from chapter 1 and have on hand) to accept a list of tab stops as arguments. Use the default tab settings if there are no arguments. I am having difficulty understanding the question (not asking for answer to it). Any help would be helpful (thus the common root "help").
0
2476
by: J. Miller | last post by:
I have a datagrid with update/cancel on one side, a button on the other which, when clicked, will take the user to a page that allows them to e-mail that particular observation's data. My problem, is that I have some columns that are sortable. To make everything work, I can wrap the e-mail code in a 'if not.postback' statement (wrong I know--testing here), but then, my sorts/updates/cancels don't work because an error is thrown from the...
3
1573
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the particular site that they would like to edit. The second would allow the user to select which admin screen they would like to edit. The second dropdown needs to be populated based on the selection in the first one. I want to encapsulate these...
6
1649
by: Andy | last post by:
.... as I know the answer will be so simple, but here goes... I cannot creating a new asp.net projects in VS2003 in a directory other than the default suggested directory (i.e. http://localhost/WebApplication1 - and renaming webapplication1). I wanted to follow the guideline in Francesco Balena et.als. latest book, by NOT creating them in this default location so that ALL of the files are kept together, and have therefore wanted to...
1
2233
by: Demetri | last post by:
I'm trying to determine if we want to use panels or user controls for our pages. Our primary concern is performance, page loading and posting speed. To illustrate my question, lets use the Customer Orders scenario: Problem: User needs to view orders and and edit, add, save on one page called Orders.aspx. To begin with the page contains a grid with basic information about an order. The user can click a row to edit or click an "Add"...
1
1479
by: Anand | last post by:
Hi, I got the below error while trying create a user from the web site administration tool provided by Asp.NET. I'm using Active directory as a membership store. I could able to add and remove users earlier from this, after this I want to implement the password reset option and to that i've added couple of (5 attributes) to the active directory (Hint Question, Hint Answer, BadPasswordCount, BadPasswordTime, BadPasswordLockOutTime - the...
11
11558
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set object and displays the data correctly when I move from row to row. The problem I am having is the data set always reads the data back and considers it change even when it's not. I am looking for how to change the following code so the...
2
2313
by: Etienne Hilson | last post by:
Hello the list :-) I do a little program that permit the user to manage list of sentences. This program runs into a linux shell. The user can add, modify and delete the sentences. What I want to do is : When the user want to modify one sentence, I would like to do this :
6
2265
by: IReallyNeedHelp | last post by:
I have saved the questions using AddQuestion.aspx page i have created but i don't know how to display it and calculate their score. this is the formview i have done, but there is some error <asp:FormView ID="FormView1" runat="server" DataKeyNames="QuestionID" DataSourceID="SqlDataSource1" Width="151px" AllowPaging="True"> <EditItemTemplate> QuestionID: ...
0
7996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7928
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
5878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3903
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3951
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1514
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.