Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding flush to Python #2239

Open
S0d4Dev opened this issue Oct 1, 2024 · 0 comments
Open

Adding flush to Python #2239

S0d4Dev opened this issue Oct 1, 2024 · 0 comments

Comments

@S0d4Dev
Copy link

S0d4Dev commented Oct 1, 2024

I have worked in a simple mastermind game made in python, and made the following code to make the letters of the text appear with a delay between them (without making newlines).

import time
def message(message, delay) :
    for letter in message :
        print(letter, flush=True)
        time.sleep(delay)

Unfortunately, this doesn't seem to work on the calculator, and results in a TypeError:
screenshot

Another way of doing this is using escape codes, such as \b for a backspace. This does work but gives a unwanted output :
screenshot (1)

To implement this flush feature, a first option would be to add the flush type, but that may not work if that is a limitation from Micropython itself. Another way to put it would be to add the sys module (or a part of it, such as stdout, if it can't fit in the calculator). The last option (that I can think of) would be to make the the escape codes such as \b work, but again, I don't know if there are some limitations around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant