Recently done testing tools, really lazy to engage in GUI, and then realize that Python comes with a module called CMD, with the discovery is simply a lifesaver. The CMD class in the default CMD module uses Rawinput to handle the work of prompt display and input information acquisition, but in certain cases there is a problem:
When the interactive thread waits for the user to enter instructions, if you want some other background thread to be able to print the information to the foreground display ...
Printing is printed, of course, but as soon as you start typing in the new instructions, the print information is erased, leaving only the prompt and the new input. If you want to see something in real time ...
Repeatedly try and read the CMD module source code later found that the Cmd class at the time of instantiation, the default will have a Use_rawinput property is 1, if the overload __init__ () when it is set to 0, Then the prompt and input will be handled by ReadLine (of course, if you play this hand on windows, you'd better put the pyreadline on, Windows I didn't get the GNU ReadLine, I don't know if it was done), Then the printing information is erased and the problem is solved.
Python constructs a command-line interface using the CMD module