Printing a line at the bottom of the console/terminal

落爺英雄遲暮 提交于 2019-12-05 09:33:42
Martijn Pieters

The easiest way is to use effbot.org's Console module:

import Console

c = Console.getconsole()
c.text(0, -1, 'And this is the string at the bottom of the console')

By specifying -1 for the second (line) argument you are addressing the last line of the console.

Because the Console module only works on Windows, to get this to work on UNIX terminals as well, you should take a look at the wcurses library, which provides a partial curses implementation that'll work on Windows. You'd drive it the same as the stdlib curses module; use the first on Windows, the latter on UNIX.

For a Windows terminal try the console module For unix the curses module would do.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!