1
votes

I'm on Mac, and I downloaded Python 3.8 from its original website. I wanted to have a custom theme for IDLE and a simple google search gave me this theme from GitHub. The instructions written on that page are

  • Place this file inside your ~/.idlerc/ folder
  • or paste its contents inside
  • /path/to/python/idlelib/config-highlight.def
  • Adapted from SublimeText's Monokai

but I couldn't find .idlerc folder, the only things that are in Python 3.8 folder are enter image description here

and I even tried looking for the videos but there are not TexEdit file where I can paste that theme from GitHub. Can someone guide me step by step about how to add that custom theme?

1
~ is your home directory. From your terminal you can get there by typing cd ~ - Paul H
@PaulH I opened cd ~/idle.rc and then opened nano and pasted that script. What to do next? - Knight wants Loong back
I'm unfamiliar with IDLE, but I imagine that you'll want to save and close that file, and then restart IDLE - Paul H
After restarting, select Options -> Keys tab. The select Custom theme Monokai. (Step 5 in Knight's answer.) The referenced theme is a dark theme. IDLE now comes with a built-in dark theme, but surely different from Monokai. This question and the answer suggest that it would be nice to have an option on the Highlights and Keys tabs to install themes and keysets from files. I will think about it when we revise those tabs. - Terry Jan Reedy

1 Answers

1
votes

All right, even using TinkerTool and clicking on "Show system and hidden files" doesn't enable us to locate .idlerc file in Finder. Follow this procedure to change the theme of IDLE with a custom theme on Mac

  1. Open terminal and type the command cd ~ then ls -al
  2. You can see .idlrc file among the large number of outputs, to open the .idlerc folder type the command cd ~/.idlerc, the folder will open. In order to know what the folder contains type the command ls -al.
  3. In the output you can see config-main.cfg and config-highlight.cfg, we have to edit these two files. Type the command open -a TextEdit config-main.cfg, a TextEdit window will open up and in that type

[Theme]

default = 0

name = monokai

Press Command + S to save the changes.

  1. Type the command open -a TextEdit config-highlight.cfg and a TextEdit window will open up. In that window paste the whole code of the theme (from that GitHub page) and save the changes.

  2. Open the IDLE -> IDLE (on the top bar) -> Preferences -> Highlights-> Custom Theme.

All the credit goes to John Rennie Sir.