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...
Related
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?
When I use from tkinter import * in vscode with atom one dark theme, I get no highlights from tkinter functions, though my code is still working.
In the picture, pack(), Tk(), Label and mainloop() is supposed to be highlighted (I know this, cause they are in the actual atom software).
Is there anyway to fix this?
Thanks!
There is nothing wrong with the code editor nor the theme. Its just how most of the theme works. Which part do you expect to be highlighted? All tkinter widgets(Label,Entry,etc.) are classes, and most themes do not have any highlighting for classes. I don't think much themes would have highlighting on class names and function names as its used very frequently.
"In the picture, pack(), Tk(), Label and mainloop() is supposed to be highlighted. Is there anyway to fix this?"
"Is supposed to be highlighted" is wrong words to use, as most themes does not highlight classes.
What usually has highlighting is, all the keywords and keyword arguments and string, etc. Since these are highlighted in your code, its working perfectly. I don't think there are any "special effects" for tkinter, as any theme for python is same as any theme for tkinter.
One way to get your desired effect, is to use a different theme, that actually will highlight classes (maybe monokai or some material themes?). I personally don't prefer alot of theme around, so something like this is perfect. Or the other way is to make or customize your themes, which can mess up the color if you are not sure what your doing.
I'm going to guess this is a problem on tkinters part and not the color theme but if it works on other themes and not one dark pro you can always try to change the exisiting colors using "yo generator code"
css-tricks does a good job showing how to install it: https://css-tricks.com/creating-a-vs-code-theme/
Altough they go through how to create your own theme. But you can always choose to import an existing theme.
Is there some way to make some words in a Python 3 input get a different color than the default one of the terminal? Like this one:
log 'Hello World'
The word "log" became blue and the string "'Hello World'" became green.
I am answering on the assumption that blue and green, for instance, are something that does not happen now but are something you would like to make happen.
If you are entering code in a system console, such as Command Prompt on Windows or Terminal on Mac and maybe some *nixes, you are unlikely to be able to get Python syntax coloring. The console would have to be able to partially parse Python syntax.
If you are entering code in a code editor that support syntax highlighting and that can parse Python code, then you can get some coloring. Some but not necessarily all will support user customization of colors.
IDLE divides Python code into multiple categories and offers both light and dark background schemes. Users can start with either and change the default colors. In your example, "log" and "'hello'" would be 'normal' and 'string' text. In the built-in themes, normal text is either black (on white) or white (on dark blue) while strings are green. The latter is likely why someone asked whether you are using IDLE. You could make a theme in which normal text is a blue that contrasts with the background.
I would like to change the Error colors in the IPython console in Spyder. Is that possible? I use Spyder 3.6 (if it matters). The error message is a mix of green and yellow... I have no know issues with my vision and I find it quite hard to read.
Here is an example:
According to this, the colors in iPython console are hardcoded and cannot be changed by Spyder itself.
One suggestion would be to switch to a dark background, so that colors like yellow are much easier to read. To do that, you can go to: Tools -> Preferences -> IPython console -> Display and click on Dark background.
Another alternative could be to use IPython %color magic to modify color scheme: https://ipython.org/ipython-doc/3/config/details.html#terminal-colors
Unfortunately, according to this, it seems as if the colour scheme cannot be changed at this moment in time.
Hopefully, the feature will be supported in future. You could try looking into a different IDE that might suit your needs.
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.