IDLE won't highlight my syntax

2020-03-21 10:17发布

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.

4条回答
一夜七次
2楼-- · 2020-03-21 11:03

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.

查看更多
霸刀☆藐视天下
3楼-- · 2020-03-21 11:04

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.

查看更多
疯言疯语
4楼-- · 2020-03-21 11:05

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)

查看更多
相关推荐>>
5楼-- · 2020-03-21 11:11

This happened to me too. Save it as .py (manually type .py in the document name), and the highlighting will come back.

查看更多
登录 后发表回答