Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

On windows+IDLE 2.7 get_terminal_size() returns default (80,25) #1714

Open
lodagro opened this Issue · 5 comments

3 participants

@lodagro
Collaborator

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)

@takluyver
Collaborator

Is there any way to get the size of the IDLE window?

@lodagro
Collaborator

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.

@takluyver
Collaborator

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.

@lodagro
Collaborator

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.

@y-p

@lodagro , is there a way to detect running under IDLE similarly to recent qtconsole work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.