On Mon, Sep 19, 2016 at 6:31 PM, Paul Moore <p.f.mo...@gmail.com> wrote:
> On 19 September 2016 at 03:40, Chris Angelico <ros...@gmail.com> wrote:
>> On Mon, Sep 19, 2016 at 12:32 PM, Steven D'Aprano <st...@pearwood.info> 
>> wrote:
>>> (The fallback if all else fails is easy: get the height of the terminal,
>>> in lines, and print that many blank lines.)
>>
>> Assuming you can get the height in lines. Have you tried that in the
>> default Windows shell? I don't think tcgetattr works on Windows.
>
> shutil.get_terminal_size() is available on all platforms.
>
> I don't think it would be unreasonable to add shutil.clear_terminal()
> (at the moment, get_terminal_size is the only "terminal handling"
> function in shutil, but it would be the obvious place to add others if
> we chose to do so).

Sounds good to me. This is definitely sounding complicated and messy
enough to justify (a) writing a function to clear the screen, and (b)
testing that function thoroughly as a PyPI module before pushing
anything into the stdlib.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to