简体   繁体   中英

How do I configure Python IDLE's text font?

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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM