Vintage Computer Display sim

I’m coding a game that was popular back in the early days of 8-bit personal computers and I want to simulate (as close as is practical) the way that some of those systems worked, such as taking some user input, then having any subsequent computer generated output, be displayed on the same line as said user input.

As a (not very good) example:


I’ve written this code that simulates the kind of speed at which text was displayed, but (obviously) when the script pauses for the user input, the computer generated text continues on the next line down, rather than (as I would like) on the same line as the user input.

import sys
from time import sleep

def output(prnt):
    """simulate the text display speed of vintage computers"""
    for char in prnt:

output("WHAT IS YOUR NAME? ")
x = input("")
output("          HOW OLD ARE YOU?")
print()  # just so that we get a newline on the CLI, when this test script exits

From what I can gather, I believe that the curses module could help, but I’ve not, as yet, looked into that because I would like to be able to code the game using as few dependencies as possible. Also, I don’t think that the curses module is cross-platform compatible, which is not a deal breaker, but it would be an annoyance, as I’d like the finished game to be as OS friendly as possible: I’m a Linux user, but I know that a good many people are not, which would severely limit the potential user base of my finished game(s).

Sorry about the length of this post, but I do feel that if the reader has all the facts up front, then any potential replies will be less trouble to construct.

Thank you for reading.

1 Like

Thank you for the (now deleted, for some reason?) reply.

I had seen a couple of ‘hacks’ that involve the use of ANSI escape sequences, but it seems to be less than a neat solution and I like (to the point of obsession, at times) clean, nice looking code, as well as code that does what I want it to do.

What I would have liked, is that the input() function, like the print() function, take an argument such as end=, so that one could have better control, but I guess there must be a very good reason for why that’s not the case.

It’s looking increasingly likely that I’ll design a GUI front end/wrapper for this, which I’ll design with future projects in mind. That way I’ll have complete control over, not only where the text is placed, but also over the font size and style.

i read Probably “wanting” a newline
read incorrectly So I wrote “There seems to be a way to return carriage”, so I deleted it
Certainly, when I searched, I found “hacks” that seem to depend on the OS
The fundamental solution is unlikely to be found by myself, so :innocent:i hope the appearance of knowledgeable people

1 Like

I ran into this package a while back:

I’ve not used it myself, but it might be what you’re looking for.


Thank you very much. That does indeed look very promising and, on the face of it, could be precisely what I’m looking for: I’ll have a read of the docs and see if I can use it in my project. :+1:

Another option for terminal apps could be textual

1 Like

Thank you very much. That also looks as if it may do what I need; maybe even overkill for the project at hand, but none the less, it’s a project link that I will pop into my notes system, as it could very well be a resource that I’ll use in the future.

Just logged on to post a little feedback (for anyone who may be interested) on the two frameworks that have been linked up in this thread.

First off, thank you to both @jhanarato and @aivarpaalberg for posting the links: both of the frameworks are very nice and have some powerful features.

Blessed is perfect for the project on which I’m working, as it gives me simple and precise control over where an insertion point (for user input) starts and where any output needs to be placed; be that an echo of the user input or some other generated output.

Textual on the other hand, provides Widget and other tools that I simply don’t need for this project, but having had a good look at it, I can see how this could be very useful for creating an app that is far more advanced than the one on which I’m working. I could use it for this project, but it would be overkill.