Can you Hack the IDLE GUI?

I’m curious to know if it’s possible to modify the IDLE Editor to extend custom functionality. I would like to add a couple of items to the editor menu to run some extensions I’m building. I can’t seem to find how to do this. i need to add items to the File->Open Editor menu. I’ve dug into the code on github but I’m just not seeing where to add my code.
Can anyone point me in the right direction?

IDLE isn’t directly customisable except in the sense that it is open source and you can copy the code and modify it.

You might be able to customise it using the “” mechanism described here:

The source code is here:

IDLE has an extension mechanism that allows addition of menu items and custom settings on the Extensions tab of the Setting dialog. The last subsection of the doc, Help and preferences / Extensions, available on the Help menu, says

IDLE contains an extension facility. Preferences for extensions can be changed with the Extensions tab of the preferences dialog. See the beginning of config-extensions.def in the idlelib directory for further information. The only current default extension is zzdummy, an example also used for testing.

I am willing to tweak this a bit to make it clearer.

Thanks very much! I’ll look into that.

I found the zzdummy but have no idea how to access it to analyze the code. It is enabled according to IDLE.

I found the source on github. Thanks!

Would the following be clearer?

In the .../Lib/idlelib directory, look at the comments at the top of config-extensions.def for instructions. Then look at for an example extension. (It is tested in `idle_test/test_zzdummy’.) Enable it on the Settings dialog Extensions tab to see it work (save your file first!).

Thanks very much!

There is also cpython/extend.txt at main · python/cpython · GitHub doc which looks helpful.

I’ll also mention that the top-level that launches IDLE is literally this:

from idlelib.pyshell import main
if __name__ == '__main__':

so it’s easy to write your own top-level that (1) imports the existing idlelib (2) monkey-patches whatever you need (3) runs main(), or your customized copy of main().
This is not the best idea, for several reasons :laughing:, but might be handy for prototyping :hammer:

I suppose contents of the extend.txt @cben mentioned could be used as basis for the doc expansion?

It seems to be fairly comprehensive.