0

I'm looking to make a console game which would constantly need to output frames of ASCII graphics, but I'm wondering how to make the function much smoother. While I don't believe the nethack-console game isn't written in Python, I'm looking at how well it can display 'animated' frames which don't seem to move around, and not clearly showing that the graphics were 'reprinted', in turn making the graphics very consistent, and any animation that happens 'seems to be done on a single print-out'. If the description isn't clear enough, let me use examples:

000X

If the 'x' would move one unit to the left, I'd like to see this on the console:

00X0

and not:

000X 00X0

Air Conditioner
  • 123
  • 1
  • 2
  • 6
  • 1
    possible duplicate of [How to create ASCII animation in a console application using Python 3.x?](http://stackoverflow.com/questions/2726343/how-to-create-ascii-animation-in-a-console-application-using-python-3-x) – APerson Jul 05 '14 at 15:02
  • Eventually you could try to use `\r` in place of `\n` - and you will have to and `,` in `print` - like `print '\r000X',` and then `print '\r00X0',`. But thera are better solution like `curses` – furas Jul 05 '14 at 15:06

1 Answers1

3

Check out curses module, or urwid library, very good begning to start with console applications. Curses (and urwid) allows you to draw frame in buffer and then update screen only in places where it's needed.

spinus
  • 5,497
  • 2
  • 20
  • 26