From stackoverflow
Python/IDLE 2.7.3
Pandas 0.8.1
Notepad++ 6.1.4 (UNICODE)
Windows Vista SP2
pandas.util.terminal.get_terminal_size()
Fails to detect the real IDLE display size and returns default (80, 25)
workaround is to use pandas.set_printoptions(max_rows=200, max_columns=10)
Comment From: takluyver
Is there any way to get the size of the IDLE window?
Comment From: lodagro
It goes wrong in pandas.util.terminal._get_terminal_size_windows()
Below is what it gives in IDLE. res should not be zero, but a tuple holding various terminal info. Because of res being zero default (80, 25) is returned by pandas.util.terminal._get_terminal_size()
>>> from ctypes import windll, create_string_buffer
>>> h = windll.kernel32.GetStdHandle(-12)
>>> csbi = create_string_buffer(22)
>>> res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
>>> print res
0
On the same machine, same python version but running python shell through pylab terminal size detection works fine. I`m not a windows python-user, and i have no immediate answer on how to fix it.
Comment From: takluyver
IDLE is not a terminal, so it's not surprising that the Windows console functions (and Linux terminal functions) don't know about it. I expect using the IPython Qt console would have the same result.
Comment From: lodagro
Tried IDLE on linux, get_terminal_size()
reports the size of the terminal where IDLE was launched. Which is the same behavior as the ipython notebook.
Comment From: ghost
@lodagro , is there a way to detect running under IDLE similarly to recent qtconsole work?