How do I configure Python IDLE's text font? - python

I've searched all over and can't seem to find a solution. Python's IDLE just looks terrible on my laptop (Lenovo Yoga 2 Pro) with a 3200x1800 display running 8.1
I've attached a screenshot so you can see what I'm talking about. Has anyone figured out how to configure this? Thanks for the help!

Add a file like %USERPROFILE%\.idlerc\config-main.cfg
Add the following lines:
[EditorWindow]
font-size = 14
font = monaco
Or pick your favorite font and size.

I presume 'terrible looking' applies to the old Courier (typewriter) font. IDLE's tk Text windows (Shell, Editor, and Output) default to using 10 point 'TkFixedFont'. On Windows, (and only on Windows), that resolves to 'Courier'. I believe that this is or at least used to be standard on Windows.
The best solution is to select Options on the top menu bar and then Configure IDLE. One is then presented with a dialog with the Fonts/Tabs tab selected and the current font selected in the Base Editor Font box and the current size next to Size. There is an example box showing some text in the current font and size. Change either the font or size and the example is updated. Select OK or Apply and current text windows are updated.
Choices other than default are written to config-main.cfg in directory %USERPROFILE%/.idlerc/. The directory and file are created if necessary.
I personally use the fixed-pitch Lucida Console. I occasionally use variable-pitch Lucida Sans Unicode when using strings with non-Latin characters. One can tell from the example in the box whether a font is fixed or variable in character width by whether characters line up neatly in columns or not. (One of my goals is to add examples from several other scripts so one can also see the unicode coverage offered by a font.)

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?

pdf2image wrong font and crop text

I am converting my PDF into an image in Python with convert_from_path from pdf2image library.
This is the original PDF :
This is the generated image :
As you can see, the issue here is that the font in the image is not the good one and also that some text is missing (the adress in the bottom).
So :
Why is my text cropped ?
How can I add the font to pdf2library ?
EDIT : Link to the PDF (download it to your computer in order to see the right font which is Mistral)
On opening the file the Appearance should look like this with fields not highlighted. There is some text as " " and fields that seem to be
on digging deeper needing to change visually NeedAppearances true.
Whilst others may attempt to put something in the field positions, and struggle with the multiline entry as that is not normal behaviour for a PDF where single line printers blocks of text are the norm. A good simple font test, is in MS Edge for a well placed font, can it be selected and read out loud? Which is not the case here, so something is wrong with the inserted text. Later we see they are FDF (i.e. plain text) entries.
When using the non 14base fonts it is essential they are fully embeded or worse sub-set but in both cases there can be restrictions on font licenses, that should also be chequed :-) pun.
The fonts are perhaps not embeded well so some viewers may see NOTHING is searchable other than , however the file says base font in use is BaseFont/BCDEEE+Calibri & FontName/BCDEEE+Calibri (presumably for all those blank texts) That includes embeded in the font the license for use, © 2018 Microsoft ... for ... Biblical Hebrew ... is Open Source Software under the MIT License ... you may use this font to create ... the Microsoft ... content ... Any other use is prohibited. Producer(DocHub v5.0.7, build 9d3cd43) (from MS Office 365).
One other font mentioned in connection with the fields is /Font << /FThcmByOND later as /BaseFont/Helvetica and presumably that font was the one intended to be used with the self adjusting fields. and Adobe also reports that there is a MyriadPro-Regular embeded somewhere as open type (I could not see that license as easily, so probably excluded or encoded)
However fonts will most likely default on Windows to Arial if the embeded characters are not applied as seen in the Xchange Editor window.
Looking internally we can see that all the text on the left is described as " " thus nothing to be shown and whilst the file declares it may use Calibri overall, the font name here is defaulting to invisible Arial.
Thus many conflicts in behaviour that result in no font to be considered usable. The visible text comes from form fields and depending how those are defined will need their appearance to be altered which is not allowed for in some viewers hence the initial blank cheque entries.

python spyder editor change menu and font size

I have shared displays and the menu font size (e.g. File Edit Search ..) but also the font of the names of python files above the editor window, are really small, making it hard to read.
I looked in "Preferences" and elsewhere, but I don't find any option to modify the font size of menu and filenames (while it is easy to modify the editor python code font size).
I attach a screenshot for illustration.
Thanks for your help.
screenshot of the Spyder window: the menu font size is really small, while the editing Python font size can be increased
If your computer has a high-resolution screen, the menu in the interface is rather small.
This can be corrected by activating scaling for high-resolution screens in
tools/preferences/application/interface/.
Go to tools/preferences/application/interface/ and setup a high DPI scaling of 1

Set the font size in pycharm's python console or terminal

There are terminal and python console in pycharm, which are very convenient. But I found that the font size was too small to recognize in terminal or python console. How can change the font size in the terminal or python console?
In PyCharm 2016.3, the console font setting is squirrelled away under Settings > Editor > Colors & Fonts > Console Font:
Note: Changes to the colors and font are not visible immediately, you have to restart the terminal session to apply them. It's not enough to just hide and reopen the terminal. Just click the red cross button on the terminal's toolbar (Close Terminal Session) and reopen it. The same is valid also for the Python Console.
The location of console font changed in the latest versions of Pycharm.
Settings -> Editor -> Color Scheme -> Console Font
Go to File\Settings\Editor\Color & Fonts and choose save as to save currently used schema by a new name in order to make changes on a new schema. Then in mentioned direction go to console font and set size.
I thought it doesn't work for me either but the problem was that:
you have to close all terminal windows to see the spacing effect.
A simple google search would have lead you here.
You just need to create a personal scheme under settings >Editor > color and fonts.
Edit:Here this further explanation may help more.
1.In color and fonts choose save as and give a scheme name.
2.Go to console font and change size and primary font, which will be inaccessible if you didn't choose the personal scheme you created earlier.

Categories