I've got a Python script that does a bunch of things in a single subthread, and I'd like the main thread to spit out raw_input("> ")
(to be handled by the main thread), and keep that input on the bottom of the console, while the subthread prints things above. I originally thought I could use s开发者_开发问答omething like print "\b\b" + message + "\n> "
in the subbthread, but that doesn't account for things like characters the user has typed in. So, the console would look something like this:
[22:04] Started
[22:06] Some output
[22:06] Some more output
>
Is this possible?
In addition to the curses suggestions, you might want to take a look at urwid, a higher-level, more python friendly library for dealing with console output.
精彩评论