IDLE won't highlight my syntax
Solution 1
This happened to me too. Save it as .py (manually type .py in the document name), and the highlighting will come back.
Solution 2
I usually have to save the file as .py before IDLE will do any syntax highlighting at all. Not sure why it would highlight for a few and then stop though. I've never had that happen.
Solution 3
Check the key binding for the toggle-auto-coloring option under Options -> Configure IDLE -> Keys -> Custom Key Bindings. The default is Ctrl+/. This should allow you to turn the syntax highlighting back on. (You can't toggle it off though, heh)
Works for me on both IDLE 2.7 and IDLE 3.3.3.
Solution 4
Is this under Windows? Is it possible your file association for Python files have possibly changed? (not quite sure why/how this could happen, but perhaps something worth checking)
Jan M.
Master in Physics (2016), University of Antwerp PhD Candidate (2016-2021), imec-Visionlab, Dept. of Physics, University of Antwerp
Updated on July 25, 2022Comments
-
Jan M. almost 2 years
Using IDLE and Python version 2.7.3. Only when I start a new file it highlights for a few lines and then just stops after I press F5. So all my text becomes plain black.
If there are equally good/better command line and editor combinations out there, you may always suggest them.
-
Jan M. about 12 yearsWell it doesn't have any association at all now. Which application should I use in my C:\Pyhon27\ folder?
-
Levon about 12 years@PatronBernard can you try python.exe - that's what I have with Windows 7 - it's a long shot, but perhaps it will help. It is odd, because most tools will just look at the .py file extension to activate the syntax highlighting.
-
Levon about 12 years@PatronBernard Here are some links for alternative Python editors: wiki.python.org/moin/PythonEditors and this stackoverflow.com/questions/126753/… Hope this helps
-
Jan M. about 12 yearsI am now using PyDev and Eclipse. Works like a charm!
-
Simon over 9 yearsI also experienced the same thing with 2.7.9 and this was the correct answer for me.
-
Jan M. almost 9 yearsNoted and changed (albeit 3 years later...)
-
wjandrea about 7 years@sterling Feel free to edit answers to add useful info.