BUG: Fixed tput output on windows
State: closed

This came up in [dask](
https://ci.appveyor.com/project/daskdev/dask/build/1.0.1397#L477). For reasons I don't understand, you can end up with a bunch of warnings like `tput: terminal attributes: No such device or address` when pandas calls `get_terminal_size`

I was able to monkey patch those calls with `shutil.get_terminal_size` and verify that the warnings were fixed. However that's python3 only. This change uses `shutil.get_terminal_size` when possible, and falls back to our prior implementation otherwise.

Not sure about unit tests, but manually, the output matches on my mac.

Labels:
name: Output-Formatting
description: __repr__ of pandas objects, to_string
name: Windows
description: Windows OS

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=h1) Report
> Merging [#16496](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e41fe7f52a7ae6be962e683f40500624b2ba2cf6?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16496/graphs/tree.svg?height=150&width=650&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16496      +/-   ##
==========================================
- Coverage   90.43%   90.38%   -0.05%     
==========================================
  Files         161      161              
  Lines       51045    51049       +4     
==========================================
- Hits        46161    46140      -21     
- Misses       4884     4909      +25
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.22% <100%> (-0.05%)` | :arrow_down: |
| #single | `40.12% <100%> (-0.05%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/terminal.py](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvdGVybWluYWwucHk=) | `16.43% <100%> (-31.39%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=footer). Last update [e41fe7f...d35dcad](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=h1) Report
> Merging [#16496](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e41fe7f52a7ae6be962e683f40500624b2ba2cf6?src=pr&el=desc) will **decrease** coverage by `0.04%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16496/graphs/tree.svg?height=150&src=pr&token=eZ4WkYLtcO&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16496      +/-   ##
==========================================
- Coverage   90.43%   90.38%   -0.05%     
==========================================
  Files         161      161              
  Lines       51045    51049       +4     
==========================================
- Hits        46161    46140      -21     
- Misses       4884     4909      +25
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.22% <100%> (-0.05%)` | :arrow_down: |
| #single | `40.12% <100%> (-0.05%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/terminal.py](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvdGVybWluYWwucHk=) | `16.43% <100%> (-31.39%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=footer). Last update [e41fe7f...d35dcad](https://codecov.io/gh/pandas-dev/pandas/pull/16496?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Any thoughts on this @jreback? I don't *think* it should break anything.
lgtm.