Kings85
Kings85

Reputation: 390

Python-IDLE editor syntax coloring sometimes stopped working

While editing a python file, IDLE is normally changing the color of special python word, change the colors of commented line, and the color of strings. All according to the color-map, (as any code-editor will do).

My problem is that sometimes after I edit the file, this color changing stop working. So commenting (or uncommenting) a line, will leave the line colors as is. (Frustration comment: it is very annoying to find out the BUG you are working on is only due a line that you thought is in a comment but it isn't)

I have two bad solutions to this problem, and I hope to find one good solution.

First bad solution is reopening the file, but it is a very bad solution, cause the color change is essential for ongoing development, and I can't always reopen each file.

My second solution is to stop working with IDLE, this is also bad, cause I like the simplicity of IDLE for quick and simple coding tasks.

This happened to me on a Windows and a Linux machine

[Edited Windows Tk version]

Upvotes: 2

Views: 5131

Answers (1)

Kings85
Kings85

Reputation: 390

In IDLE there is a hidden key combination CTRL-/, that toggles Auto Coloring. Currently there is no way to disable it, for more information see this bugs.python.org/issue27170.

I post this answer after investigation this issue with @terry-jan-reedy in the question comments.

The reason I used CTRL-/ in the first place is because of habit from using PyCharm - which is used for comment a line.

Upvotes: 7

Related Questions