Highlighting comments in Python script - python

I am using Pycharm. I often use # TODO, which highlights the comment in blue. Is it possible to highlight other comments in a different colour, using other keywords?
For example, I would like to be able to highlight important notes in red, say using # NOTE.

To add a custom highlight for comments in Python scripts, go to File -> Settings -> Editor -> TODO and add a new pattern:
Configure, as needed:
Bright Red is hard to miss:
PyCharm HELP

Related

Python syntax highlighting using PyChar and IDLE

I have a text editor I'm working on. Using PyCharm. I have line number support (many thanks to Bryan Oakley!) and python syntax highlighting using IDLE Perculator. It works but some of the highlight code is hard to read. Oh yes, using tkinter for GUI support.
Can anyone point me at how to set the colors in IDLE? I use options-configure IDLE and some of the changes work in my project and some don't. For example, disabling the colors in my find funcion in the editor doesn't use the 'found' attribute when I alter the 'found' highlight colors. It only highlights what is found when I set the foreground and background colors.
I would prefer to edit a file so I know what it is highlighting, such as comments, strings, keywords, etc.
The IDLE Perculator works better than all of the highlight code I tested.
Just been trying to work out how to set the highlight colors to what I want. Either light or dark themes.
Found basic doc. for IDLE but nothing on how to figure out what is what. Only some settings take effect.
I found all of the idlelib source in the appdata folders and put it into my project folder. I know can set the backgrounds in the IDLE shell for the various keywords etc. Looks ok for a dark theme now. When I run or compile I get the colors I set in the IDE in my text (editor) widget. I still have to set the default text colors in my app. When I don't, I get black text on white background which looks terrible in the dark theme.
So a little more work...

In PyCharm how can I move the text to the left? I don't like it in the center

I would like to see all the code text on the left when I open PyCharm. I don't like that the code is all placed in the center. I would like to move it to the left. How can I?
There are no spaces before the code. It happens to all PyCharm files. The same files, if imported into another editor, have the code positioned on the left and there is no space.
Seems like the distraction free (view-)mode is active.
Try View > Appearance > Exit Distraction free mode.
This is what a plain Python file looks like in a fairly standard installation of PyCharm.
Note how there's no ruler over the editor, where yours appears to have one, and the gutter is coloured differently, while yours looks wide and has the same colour as the editor.
Your configuration is certainly not the default installation with a new default project. Perhaps you installed some sort of theme, or plugin that modifies the look?

how to 'dim' certain python statements in PyCharm

PyCharm version: Community Edition 4.0.4
Is it possible to customize my color scheme for a python file in PyCharm such that certain statements are of darker color?
e.g. I want to make all statements starting with "logger" to be of gray color so that I can focus on my main code without having to wade through lot of info/debug statements.
I tried to find out if I can add new keyword in keywords1 keywords2 keywords3 keywords4 but can't find any such option. And on top of that, I can't find any way to alter colors for keyword1/2/3/4 individually.
I can't be the only one wanting to hide/dim logging statements!
There is no such feature in PyCharm 4.

How do I make pyCharm stop hiding (unfold) my Python imports?

Every time I open a Python file PyCharm will hide all imports and shows:
import ...
within the editor.
I have to manually unfold it to see the imports. Where do I find the setting to undo auto-hiding of import statements?
As this question may be useful for people who also are not looking for the term "code folding", I'll make my comment an answer.
As extracted from IntelliJ IDE Web Help, but also worked on PyCharm CE 3.4.1:
Open the IDE Settings (File > Settings, or Ctrl+Alt+S).
Under the "Editor" node, click "General" and then "Code Folding". The "Code Folding" page is displayed.
In the "Collapse by default list", select the check boxes to the left of the code constructs you want to be displayed collapsed. So here you can uncheck "Imports".
Apply changes.
The image below shows what it looks like:
Actually in pycharm 2016.1 it's Editor -> General -> Code Folding

Python: wingIDE syntax highlighting customization

I'm using the free version of wingIDE. I am trying to customize individual syntax highlighting colors (comments, strings, constants, normal text, etc). I see the generic color changes for 'background,selected text", etc, but nothing that lets me get down to specifics. Is this a limitation of the free version or is the option hidden deep in the UI? Thanks.
This is now available in the free version 6.0.8-2 (probably one or two releases after yours, PPTim...).
Go to Edit -> Preferences -> Editor -> Syntax Coloring. From here you can alter each type. I use the 'Solarized - Dark' color palette (set this in the User Interface menu, at the very top of the Preferences window) which can make open string highlights difficult to read. In the Syntax Coloring view, this is 'stringeol'. I've altered the background to Black Pearl. For a list of other colour names and descriptions, see the Wing IDE documentation.

Categories