Well, it is certainly possible. First, the hard way: you use the ANSI termainal control commands (you can find the reference on the web, or if you need it I can send you an HTML file containing them). Second, the better way: you can use the ncurse library (via the curses Python module). There you'll get a whole toolkit for TUI (Terminal User Interface ;) ).
BTW, if you happen to need this while drawing only a single line, the "\r" char gets you at the beginning of the current line ! So flushing stdout and then sending the "\r" char will allow you to overwrite the current line. Pierre Ed Singleton a écrit : > Is it possible (and easy) to change something you've already printed > rather than print again? > > For example, if I'm making a little noughts and crosses game and I > print the board: > > | | > | | > ___|___|___ > | | > | | > ___|___|___ > | | > | | > | | > > Then the computer has it's go, and rather than print the board out > again and have the previous empty board appear higher up, I want to > just add a X to the board I've already created. > > Eg. > > > | | > | | > ___|___|___ > | | > | X | > ___|___|___ > | | > | | > | | > > I've programs do this on the command line in Linux, so I assume it > must be possible. (I don't mind making my programs Linux only so > that's not a problem). > > Any clues or pointers to documentation gratefully recieved. > > Thanks > > Ed > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Pierre Barbier de Reuille INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde 34398 MONTPELLIER CEDEX 5, France tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor