Creating old fashion console form using Python
How can I write a console form looking like the one seen on the screenshot using python. This means that I can write something like
print(x=6, y=2, "z/VM ONLINE")
This code should place the text almost in the upper left corner as seen on the screenshot. Importantly the output text should never make all the other text scroll. It is also important that I can place the cursor at any coordinate and that the user is able to input text at that place.
EDIT: I need something that works under开发者_StackOverflow社区 Windows.
The Python curses
module is made for this purpose.
You need to learn (in great depth) the precise capabilities of the terminal you wish to use. Specific bytes will cause the character to move left, right, up and down - or maybe not, depending on the capabilities of the terminal emulator you are using.
If you can't move the character, you'll have to keep in mind just how wide and tall the window is, and print out a "screen".
That is, to write 'z/VM Online' in the top left corner, you can just do so - and then output enough lines so that is now at the top of the screen.
Or you can just use an ncurses library.
精彩评论