1. 程式人生 > >python IDLE 背景以及字型的修改

python IDLE 背景以及字型的修改

為了保護眼睛,決定把白色背景換掉:
1 首先,在已經下載好的python檔案目錄下,找到config-highlight.def檔案,我的是在H:\python\python3**\Lib\idlelib**資料夾下。
2.開啟檔案後,你會看到一些預設的顏色配置,比如經典的顏色配置就是白色背景,一般這個檔案中會有兩種配置可供選擇:
[IDLE Classic]和
[IDLE New],表現在IDLE介面上就是在python shell下,選擇options—configure IDLE—-highlighting選項中,右側的highlighting theme主題選擇,有兩種可選方案,就上檔案中的那兩種。
3.如果直接在原始檔上修改顏色有些麻煩,除非你特別熟悉顏色。網上有經典的背景配置:

[Obsidian]
definition-foreground = #678CB1
error-foreground = #FF0000
string-background = #293134
keyword-foreground = #93C763
normal-foreground = #E0E2E4
comment-background = #293134
hit-foreground = #E0E2E4
builtin-background = #293134
stdout-foreground = #678CB1
cursor-foreground = #E0E2E4
break-background = #293134
comment-foreground = #66747B hilite-background = #2F393C hilite-foreground = #E0E2E4 definition-background = #293134 stderr-background = #293134 hit-background = #000000 console-foreground = #E0E2E4 normal-background = #293134 builtin-foreground = #E0E2E4 stdout-background = #293134 console-background = #293134
stderr-foreground = #FB0000 keyword-background = #293134 string-foreground = #EC7600 break-foreground = #E0E2E4 error-background = #293134 [tango] definition-foreground = #fce94f error-foreground = #fa8072 string-background = #2e3436 keyword-foreground = #8cc4ff normal-foreground = #ffffff comment-background = #2e3436 hit-foreground = #ffffff break-foreground = #000000 builtin-background = #2e3436 stdout-foreground = #eeeeec cursor-foreground = #fce94f hit-background = #2e3436 comment-foreground = #73d216 hilite-background = #edd400 definition-background = #2e3436 stderr-background = #2e3436 break-background = #2e3436 console-foreground = #87ceeb normal-background = #2e3436 builtin-foreground = #ad7fa8 stdout-background = #2e3436 console-background = #2e3436 stderr-foreground = #ff3e40 keyword-background = #2e3436 string-foreground = #e9b96e hilite-foreground = #2e3436 error-background = #2e3436

直接把上面的程式碼copy到剛才開啟的config-highlight.def檔案中,然後重啟shell就可以。
重啟後,shell會預設選擇原來的。你就在highlighting theme主題中檢視,此時已經多了兩種主題,就是你剛才新增的。
這裡寫圖片描述

主題名字為tango..
大功告成。。

字型的修改

在setting中,如果你設定的字型是中文字型,再怎麼修改大小也是沒有用的。必須把字型改為英文字型才行。。
這裡寫圖片描述