Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expand width of shell in Python's IDLE

I'm new to python and I'm using Python's IDLE. Using numpy, I created a 24 x 24 matrix. I simply want to look at the matrix. I've maximized the shell on my monitor, so there's plenty of room to print the entire 24 columns' width, but it's only printing the first 13 columns of then continuing onto the next line to print the next 11 columns (had trouble in Stack Overflow copying and pasting what it's doing). The entire right half of the Shell window is blank (it's compressing everything to fit in the left half).

This is harder to read than if it printed 24 columns wide. Can anyone tell me how to convince IDLE to print using the entire width available of the shell (rather than just the left half)? I recognize this is a bit of a stupid question and apologize, but it's driving me crazy.

It looks sort of like this (again, Stack Overflow problems in trying to paste):

[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]])

Thanks, Mitch

like image 973
Mitch Downey Avatar asked Oct 14 '11 16:10

Mitch Downey


People also ask

How do I use IDLE shell in Python?

To execute a file in IDLE, simply press the F5 key on your keyboard. You can also select Run → Run Module from the menu bar. Either option will restart the Python interpreter and then run the code that you've written with a fresh interpreter.

What is Python shell and IDLE?

The shell is the default mode of operation for Python IDLE. When you click on the icon to open the program, the shell is the first thing that you can see. Here, you can see a blank Python interpreter window. 00:16 You can use it to start interacting with Python immediately, testing it out with a short line of code.

How do you write Python code in IDLE?

Clicking on IDLE will open up the Python shell. You can either start writing your code here or hit control + N and open up a new file. Write your code in this file and save it. IDLE automatically saves all the files either with .

What are IDLE usability features in Python?

IDLE has the following features: coded in 100% pure Python, using the tkinter GUI toolkit. cross-platform: works mostly the same on Windows, Unix, and macOS. Python shell window (interactive interpreter) with colorizing of code input, output, and error messages.


1 Answers

Do

import numpy as np
np.set_printoptions(linewidth=999999)

For more, check

help(np.set_printoptions)
like image 148
pv. Avatar answered Oct 01 '22 21:10

pv.