"Asrarahmed Kadri" <[EMAIL PROTECTED]> wrote > Is it possible to make the utility like in vi, where the user keeps > on > entering the data and when he hits ':wq', the work is saved and the > application exists.
YES BUT THE ACTUAL CODE TO READ KEYSTROKES AS THEY ARE TYPED WILL BE VERY DIFFERENT DEPENDING ON WHEHER YOU USE A gii OR A TEXT CONSOLE. SEE MY EVENT HANDLING TOPIC FOR EXAMPLES OF BOTH STYLE TO COMPARE AND CONTRAST. Oops!! Sorry for the upper case, not meaning to shout but this mail tool has no case inversion, and its late... -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld > I guess the use of standard input file would be applicable??? > > Thanks. > Regrds, > Asrar > > On 10/14/06, Alan Gauld <[EMAIL PROTECTED]> wrote: >> >> > I am trying to build a simple text editor which has a couple of >> > options of >> > editing, displaying and saving the file. >> >> Are you using a GUI or console? >> The solution is potentially quite different depending on the >> choice. >> >> > Now what I want to do is to allow teh user to keep entering the >> > text >> > unless >> > he pressed ':q'. >> >> How are you reading the characters in the first place? >> >> if you can find a way to read characters from the keyboard >> one at a time then >> >> while True >> ch = getchar() >> if ch ==':' >> ch = getchar() >> if ch == 'q': break >> >> Will work. >> >> So the question becomers do you know how to write getchar()? >> >> Alan G. >> >> >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> http://mail.python.org/mailman/listinfo/tutor >> > > > > -- > To HIM you shall return. > -------------------------------------------------------------------------------- > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor