This is implemented here only for posix platforms, but probably
could be generalized.
It has only one minor ill effect that I am aware of: upon exiting the pager, one must hit CR to get a prompt back. I have been unable to figure out why that is, or how to fix it, but it is a consequence of running the PyOs_InputHook, not of the change from popen to subprocess.Popen.
Run PyOs_InputHook in pager to keep plot windows interactive.
page.page: use io.flush() to get the prompt back after running the pager
page.page: code cleaned up, commented regarding remaining problem.
There are still major problems and puzzles regarding getting back
to the prompt, and a hangup with Tk.
My second commit turned out to be no help at all; I was not testing it under the right circumstances, which is with an InputHook in place.
I'm closing the request now because although the need to hit CR to get back to the prompt is perhaps tolerable, the method is failing completely with Tk. I'm stumped.