jquast / blessed

Blessed is an easy, practical library for making python terminal apps
http://pypi.python.org/pypi/blessed
MIT License
1.18k stars 71 forks source link

"Enter" is required to show printed #227

Closed ghost closed 2 years ago

ghost commented 2 years ago

Sorry if this is the wrong place to ask, but I'm getting desperate.

In this very basic snippet I just want to print whatever is entered:

from blessed import Terminal

term = Terminal()

with term.cbreak():
    while True:
        print(term.inkey(), end='')

However, nothing shows up on screen until I hit Enter. Then everything gets printed at once.

It also works when I leave out "end=''", but I don't want a linebreak here.

Why does it behave like this? Have I misunderstood something? Thanks in advance!

jquast commented 2 years ago

Add argument, flush=True to the print function

ghost commented 2 years ago

Holy smokes you're fast! Thanks, it works :)