Eclipse, PyDev Syntax Coloring - python

In Preferences-PyDev-Editor-"Appearance Color Options" I can edit colors. I can edit the color of "keywords" for instance. Is there a way to edit color of a specific keyword, say "range"?

There's currently no such feature (i.e.: the keywords are all 'hardcoded' to a single color).
If you fell that this is really needed, please create a feature request explaining your use-case in the pydev tracker. (see: http://pydev.org/about.html)

Related

What do the Python VSCode syntax colors mean?

VSCode has syntax highlighting for the Python language. I can't find any explanation for how each token is classified and organized into colors.
Specifically, why are some keywords the same color, but some are different?
Looking at this code:
for...in shows the keywords as the same color, but if...in shows the keywords as different colors. Why does in change color? What determines if a keyword is purple or blue or something else?
Finally, is there an exhaustive list or chart for how keywords are organized?
The color of the code in VSCode is provided by the theme. (VSCode uses its own theme by default.) Reference: syntax-highlighting-optimizations and theme color.
Using different themes can make the code display different colors. You could also set the color of custom code. Reference: Customizing a Color Theme.
They are not the same in. The first is used to iterate while the second is an operator.
From the first link in #JillCheng's answer I found the Scope Inspector, which can be enabled by running Developer: Inspect Editor Tokens and Scopes in the command palette. This will then show how the currently selected text was tokenized.
for...in shows both keywords are tokenized as keyword.control.flow.python.
if...in shows if as keyword.control.flow.python and in as keyword.operator.logical.python.
Note: This answer was originally posted as part of the question.

Highlighting comments in Python script

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

matplotlib interactive alteration of line properties

I've been looking for a graphical / ipython console based means to turn lines on and off in a 2D graph generated with matplotlib, but I haven't found anything thus far.
Does anyone know a way to do something like this? What I have in mind specifically is incorporated in MATLAB, and can be seen here:
http://matlab.izmiran.ru/help/techdoc/creating_plots/plot_to5.html
All of the check boxes in the plot browser window will turn the lines on and off; their properties can also be altered graphically in another dialogue box. For now, I've been clicking on the properties button, and setting linetype to none, but this is cumbersome for a graph with many lines...
Thanks Vadim for your answer - you're right that the widgets provide an example with this functionality - to an extent. The example you provide doesn't give the graphical feedback I had in mind; instead, the widgets example closest to my request is actually check_buttons.py (see: http://matplotlib.org/examples/widgets/check_buttons.html)
Here, a side-box of labelled check buttons can be created, where upon clicking the checked buttons, it will turn the lines on and off - see the figure below. I suppose this could be built up into something along the lines of a plot browser like in matlab, but would require additional work to incorporate simple changes to the line style, etc.
I am still interested to know if someone has already done all of the work in making such functionality available; if not, I will post my best attempt when I get around to it.
plot_browser
I don't have sufficient rep points to add the image inline; my apologies.
Yes, there exists module named matplotlib.widgets. There are some example here. It allows you to do exactly what you asked for (source):

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.

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