Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lodagro opened this issue Jul 31, 2012 · 5 comments
Closed

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

lodagro opened this issue Jul 31, 2012 · 5 comments
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string

Comments

@lodagro
Copy link
Contributor

lodagro commented Jul 31, 2012

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
Copy link
Contributor

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

@lodagro
Copy link
Contributor Author

lodagro commented Aug 1, 2012

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
Copy link
Contributor

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
Copy link
Contributor Author

lodagro commented Aug 2, 2012

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.

@ghost
Copy link

ghost commented Dec 12, 2012

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

@wesm wesm added the Won't Fix label Sep 29, 2016
@wesm wesm closed this as completed Sep 29, 2016
@jorisvandenbossche jorisvandenbossche modified the milestones: Someday, No action Sep 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

4 participants