我正在尝试Python脚本的一些光标图形输出,为我的应用程序提供了一个很好的进度条。
在显示输出之前,我使用以下内容确保我的屏幕为空白。
print term.clear但是当我的Python脚本完成时,我的shell提示符会在屏幕顶部输出,覆盖部分进度条。
当Python脚本退出时,如何将光标移动到我的图形输出下方? 我在退出脚本之前尝试过这个:
print term.move(0, term.height-1)但这似乎被忽略了。 我的shell开始在屏幕顶部输出。
我不想进入全屏模式,我想在脚本完成后将进度条的最终输出留在屏幕上。
我的环境是:
OS X 10.10终端处于xterm-256模式。 Python 2.7.10 祝福1.6I'm trying out some cursor-graphical output of a Python script, to give my app a nice progress bar.
I use the following to ensure my screen is blank before displaying output.
print term.clearBut when my Python script finishes, my shell prompt is output at the top of the screen, overwriting part of the progress bar.
How can I move the cursor to below my graphical output as the Python script exits? I have tried this right before exiting the script:
print term.move(0, term.height-1)But this seems to be ignored. My shell begins output at the top of the screen.
I don't want to enter fullscreen mode, I'd like to leave the final output of the progress bar on the screen after the script finishes.
My environment is:
OS X 10.10 Terminal in xterm-256 mode. Python 2.7.10 Blessings 1.6最满意答案
我认为你有向后的term.move()参数(基于这里的“永久移动”部分)。
move() Parameters are y coordinate, then x coordinate.尝试这个:
print term.move(term.height - 1, 0)I think you have the arguments to term.move() backwards (based on the "Moving Permanently" section here).
move() Parameters are y coordinate, then x coordinate.Try this:
print term.move(term.height - 1, 0)更多推荐
发布评论