【问题标题】:IDLE background color in pythonpython中的IDLE背景颜色
【发布时间】:2016-01-08 22:42:50
【问题描述】:

有没有办法在 windows 10 下改变 python-3.5 IDLE 的背景颜色? 我试过谷歌和阅读文档,但我找不到答案。我什至不确定这是否可能......

【问题讨论】:

  • 如果您愿意,您可以使用另一个具有可更改背景的文本编辑器并将文件另存为“.py”。但我猜那会不方便跑步。
  • 不。在这里更改 IDE 不是一个选项。
  • 如果你想要一个monokai主题,请访问gist.github.com/jaimergp/10285906

标签: python-idle python-3.5


【解决方案1】:

对于文本窗口背景,转到选项 => 空闲首选项 => 突出显示选项卡。将内置主题(两者相同)另存为自定义主题,并使用新名称。将具有白色背景的每个元素的背景更改为您想要的颜色。点击应用或确定。或者,将以下内容复制到 <HOMEDIR>/.idlerc/config-highlight.cfg(可能已经存在也可能不存在)并将 #ffffff 更改为您想要的颜色。

[Custom Light]
normal-foreground= #000000
normal-background= #ffffff
keyword-foreground= #ff7700
keyword-background= #ffffff
builtin-foreground= #900090
builtin-background= #ffffff
comment-foreground= #dd0000
comment-background= #ffffff
string-foreground= #00aa00
string-background= #ffffff
definition-foreground= #0000ff
definition-background= #ffffff
hilite-foreground= #000000
hilite-background= gray
break-foreground= black
break-background= #ffff55
hit-foreground= #ffffff
hit-background= #000000
error-foreground= #000000
error-background= #ff7777
#cursor (only foreground can be set, restart IDLE)
cursor-foreground= black
#shell window
stdout-foreground= blue
stdout-background= #ffffff
stderr-foreground= red
stderr-background= #ffffff
console-foreground= #770000
console-background= #ffffff

我们刚刚添加了一个带有深钴蓝色背景的 IDLE Dark 主题。为此,请保持 #002240 原样或更改为另一种深色。

[Custom Dark]
comment-foreground = #dd0000
console-foreground = #ff4d4d
error-foreground = #FFFFFF
hilite-background = #7e7e7e
string-foreground = #02ff02
stderr-background = #002240
stderr-foreground = #ffb3b3
console-background = #002240
hit-background = #fbfbfb
string-background = #002240
normal-background = #002240
hilite-foreground = #FFFFFF
keyword-foreground = #ff8000
error-background = #c86464
keyword-background = #002240
builtin-background = #002240
break-background = #808000
builtin-foreground = #ff00ff
definition-foreground = #5e5eff
stdout-foreground = #c2d1fa
definition-background = #002240
normal-foreground = #FFFFFF
cursor-foreground = #ffffff
stdout-background = #002240
hit-foreground = #002240
comment-background = #002240
break-foreground = #FFFFFF

我们计划添加一种方法来一次更改所有正常背景。能够影响对话框将是以后的项目。

【讨论】:

  • 在 python 3.8.1 中找不到这个文件,知道在哪里可以找到它吗?不喜欢手动为每个项目做的想法。
  • @Mitrek 我不确定你所说的“这个文件”是什么意思。 <HOMEDIR>/.idlerc/config-highlight.cfg ?正如我所说,它“可能已经存在,也可能不存在”。它肯定在 3.8.1 中使用。一次性使用所有背景。
  • @Mitrek 作为 3.7.3 用户,我可以在<pythonDir>/Lib/idlelib/config-highlight.def找到它
【解决方案2】:

以下是步骤:

  1. 打开空闲
  2. 转到顶部选项卡中的“选项”
  3. 选择“配置空闲”
  4. 从顶部水平选项卡中选择“亮点”
  5. 选择左侧IDLE图像上方的“背景”单选按钮
  6. 在右侧“突出显示主题”下,根据您的喜好点击“IDLE Classic/IDLE Dark/IDLE New”
  7. 点击应用,然后点击确定

    完成!

【讨论】:

    【解决方案3】:

    遵循这些步骤并保护您的眼睛。

    1. 从安装 Python 时选择的路径打开 Python 文件夹。在这种情况下,它是 ( C:\Python27 )

    2. 在Python27文件夹中,搜索Lib并双击。

    3. 在Lib文件夹中,搜索idlelib文件夹并双击。

    4. 在 idlelib 文件夹中,搜索 CONFIG-HIGHLIGHT.DEF 文件并使用任何文本编辑器工具(如记事本)打开它。

    5. 在 CONFIG-HIGHLIGHT.DEF 文件中,粘贴下面给出的 Monokai 代码。保存并关闭文件。

      [monokai]
      
      normal-foreground= #F8F8F2
      normal-background= #272822
      keyword-foreground= #F92672
      keyword-background= #272822
      builtin-foreground= #66D9EF
      builtin-background= #272822
      comment-foreground= #75715E
      comment-background= #272822
      string-foreground= #E6DB74
      string-background= #272822
      definition-foreground= #A6E22E
      definition-background= #272822
      hilite-foreground= #F8F8F2
      hilite-background= gray
      break-foreground= black
      break-background= #ffff55
      hit-foreground= #F8F8F2
      hit-background= #171812
      error-foreground= #ff3338
      error-background= #272822
      cursor-foreground= #F8F8F2
      stdout-foreground= #DDDDDD
      stdout-background= #272822
      stderr-foreground= #ff3338
      stderr-background= #272822
      console-foreground= #75715E
      console-background= #272822       
      

    来源:CodeHexz

    PYTHONING 祝所有夜猫子们快乐 :)

    【讨论】:

      【解决方案4】:

      用于空闲的黑暗背景

      Daniel Puiu 和 Megha Chovatiya 的上述回答非常好。我听从他们的指示,并有一些额外的个人经验,我也想分享:

      此说明会很详细,可以申请定制版:

      打开空闲

      1. 转到顶部选项卡中的“选项”
      2. 选择“配置空闲”
      3. 从顶部水平选项卡中选择“亮点”

      ***因为我想让IDLE背景变暗所以在Highligting主题->内置主题->点击“IDLE class”改为“IDLE dark”

      1. 有一个小编码图,你可以点击选择你要改变颜色的具体编码参数。那么:

        • 当您想要更改似乎是 word 文档中突出显示颜色的文本的背景时,请选择“背景”单选按钮

        • 或者选择“前景”来调整文字的颜色

      然后“选择颜色”以选择您想要的颜色。可以同时看编码图,看看你的变化

      1. 当您感觉良好时,单击“应用”并命名自定义。

      此外,您可以通过以下方式更改文本大小或加粗文本:

      从顶部水平选项卡转到“字体/选项卡”并根据您的样式更改文本

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-07-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-09-10
        • 2017-05-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多