3

I'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.clear

But 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
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828

1 Answers1

2

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)
FMc
  • 41,963
  • 13
  • 79
  • 132
  • Thanks, the docs are not clear on the arguments to the `move()` function. I tried what you suggested, but it does not change the behavior I'm seeing. The shell prompt still outputs at the top of the screen after the script exits. – Bill Karwin Jan 16 '17 at 18:51
  • I found my mistake. I executed `term.move()` where I should have executed `print term.move()`. Silly mistake! – Bill Karwin Jan 16 '17 at 18:55