How to turn on line numbers in IDLE?

python idle extensions
idlex line numbers
line numbers - python
how to enable line number in python idle
idle editor
idle command line
idle download
how to view line numbers in python idle

In the main shell of IDLE, errors always return a line number but the development environment doesn't even have line numbers. Is there anyway to turn on line numbers?

Version 3.8 or newer:

To show line numbers in the current window, go to Options and click Show Line Numbers.

To show them automatically, go to Options > Configure IDLE > General and check the Show line numbers in new windows box.

Version 3.7 or older:

Unfortunately there is not an option to display line numbers in IDLE although there is an enhancement request open for this.

However, there are a couple of ways to work around this:

  1. Under the edit menu there is a go to line option (there is a default shortcut of Alt+G for this).

  2. There is a display at the bottom right which tells you your current line number / position on the line:

How to turn on line numbers in IDLE? - Article, option (there is a default shortcut of Alt+G for this). Unfortunately there is not an option to display line numbers in IDLE although there is an enhancement request open for this. However, there are a couple of ways to work around this: Under the edit menu there is a go to line option (there is a default shortcut of Alt+G for this).

There's a set of useful extensions to IDLE called IDLEX that works with MacOS and Windows http://idlex.sourceforge.net/

It includes line numbering and I find it quite handy & free.

Otherwise there are a bunch of other IDEs some of which are free: https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

serwy/idlex: IdleX - IDLE extensions for Python, is actually a Python program that uses the standard library's tkinter GUI toolkit to build its windows. Unfortunately there is not an option to display line numbers in IDLE although there is an enhancement request open for this. However, there are a couple of ways to work around this: Under the edit menu there is a go to line option (there is a default shortcut of Alt+G for this).

If you are trying to track down which line caused an error, if you right-click in the Python shell where the line error is displayed it will come up with a "Go to file/line" which takes you directly to the line in question.

Showing line numbers in IPython/Jupyter Notebooks, LineNumbers.py. Provides a panel for displaying line numbers in the editor. This can be toggled using "Show Line Numbers" under the Options menu. Many IDEs do show line numbers by default. And it does make discussing code with others simpler, e.g. when teaching. But I tend to agree with Raymond that it would be better to keep the default interface clean. Anyone who will want line numbers will be able to turn them on them easily.

As it was mentioned by Davos you can use the IDLEX

It happens that I'm using Linux version and from all extensions I needed only LineNumbers. So I've downloaded IDLEX archive, took LineNumbers.py from it, copied it to Python's lib folder ( in my case its /usr/lib/python3.5/idlelib ) and added following lines to configuration file in my home folder which is ~/.idlerc/config-extensions.cfg:

[LineNumbers]
enable = 1
enable_shell = 0
visible = True

[LineNumbers_cfgBindings]
linenumbers-show = 

IDLE editor, Under the edit menu there is a go to line option (there is a default shortcut of Alt+​G for this). There is a display at the bottom right which tells you your current line  From the menu, select View ▸ Show Line Numbers or right click in the left margin and select Show Line Numbers from the pop-up menu.

Line numbers were added to the IDLE editor two days ago and will appear in the upcoming 3.8.0a3 and later 3.7.5. For new windows, they are off by default, but this can be reversed on the Setting dialog, General tab, Editor section. For existing windows, there is a new Show (Hide) Line Numbers entry on the Options menu. There is currently no hotkey. One can select a line or bloc of lines by clicking on a line or clicking and dragging.

Some people may have missed Edit / Go to Line. The right-click context menu Goto File/Line works on grep (Find in Files) output as well as on trackbacks.

Extensions - IdleX, How to turn on line numbers in the IDLE Editor included in Anaconda for Py 3.6.1​? Sign in to reply. 7/5/17 Will Warner. Showing line numbers  From this point you can click the Go button near the top of the window. This will make the program run at normal speed until a breakpoint is encountered (or input is requested or the program finishes). You can also use the Step button to step through your code, one line at a time. This button is used quite a lot.

Line numbers in IDLE, But for christ's sake, why doesn't it come with line number option? Some times I think the editor designers never program a line of code in life. To remove line numbers from a single paragraph, click Suppress for Current Paragraph. What do you want to do? Add line numbers. Remove line numbers. Add line numbers. You can add line numbers to all or part of a document. To view line numbers, you must be in Print Layout view (click the View tab to check). A table is counted as one line.

No line number in idle editor., In the main shell of IDLE, errors always return a line number but the Unfortunately there is not an option to display line numbers in IDLE  6. To turn off the line number feature in SQL Server Management Studio you need to navigate to Tools | Options | Text Editor | General | Display and uncheck the Line Number check box and click the OK button to save the changes so that next time you open a new query window in SSMS line numbers will not be displayed.

How to turn on line numbers in IDLE?, By default IDLE (the standard Python IDE) does not show line numbers :-( You can install the extension IdleX to do this. This is only one of  Then, click on the + next to Code Editor to expand that section. Then, click on Line Gutter. The Show Line Numbers option is then shown. If you check this, the line numbers will appear in your code. Possible Values. So, the Line Numbers setting can be changed to: Checked: Line numbers are shown in the Code Editor window.

Comments
  • Wow, an IDE without line numbers? Does anyone else find that as bizarre as me?
  • @PaulFeakins The original IDLE designers apparently felt that the line number on the status bar and two ways to go to a line number were minimally sufficient. And there were technical issues in getting them right. I have used IDLE daily and for my use have hardly missed them. In any case, we just added them. Details in my answer.
  • In Python 3.8 IDLE a new option has been added in the menu bar: Options -> Show Line Numbers
  • On Mac the shortcut for navigating between lines is cmd+j.
  • While this workaround works, why were numbered lines not included in the first release. It seems like an obvious feature. Very disappointing that this isn't included.
  • If using brackets for scoping is confusing, then line numbers is rocket science.
  • An enhanced patch for the line number request, issue 17535, was just merged. See my answer for details.
  • Believe it or not, I really like Microsoft's VS Code now. It's a great light weight IDE with really good python plugins. It also works across mac/linux/windows. What a strange (good) world we live in where Microsoft is going open source.
  • Nice hacking! Seems like IDLE could do something similar to incorporate the code and settings to its internal cfg (as opposed to the extensions cfg) and wire up the option to the GUI. They probably didn't bother because IDLEX provides the functionality via plugin mechanism.
  • Is C:\Python\Python37\pythonw.exe "C:\Python\Python37\Scripts\idlex.pyw" saved as .bat on Windows?
  • First, create Shortcut of pythonw.exe on desktop. Second, right click the shortcut -> property or attribute (R). Third, fill Target(T): with C:\Python\Python37\pythonw.exe "C:\Python\Python37\Scripts\idlex.pyw". done.
  • Thanks, but I found we can create a idlex.bat file like what Python36\Lib\idlelib\idle.bat does and create shortcut for idlex.bat.