如何开始为 python IDLE 开发扩展?

How can I get started developing extensions for python IDLE?

如何在 IDLE 中开发扩展?在 IDLE 的首选项中,我看到了这个并且很想学习如何制作我自己的扩展:

<pythondir>/Lib/idlelib/extend.txt 解释了如何编写扩展模块 class。 <pythondir>/Lib/idlelib/zzdummy.py 是一个(不完整的)示例扩展模块,带有示例 ZzDummy class .

<pythondir>/Lib/idlelib/config-extension.def 中的注释解释了如何向该文件添加条目,以便 IDLE 包含扩展名。 ZzDummy 条目是一个示例扩展条目。如果您在 zzdummy.py 中取消注释 ZzDummy.menudefs,请在“设置”对话框的“扩展”选项卡上启用 ZzDummy 扩展,如图所示,然后重新启动 IDLE,将出现 z inz out 条目在格式菜单的底部。但是,菜单条目不起作用,这就是 menudef 被注释掉的原因。

你的问题让我想起了 https://bugs.python.org/issue32631. I have edited and merged the patch and the backports are in progress. The changes will be in the next releases of 3.8, 3.9, and 3.10. You can see the changes now at https://github.com/python/cpython/pull/14491/files. The new version of zzdummy is https://github.com/python/cpython/blob/master/Lib/idlelib/zzdummy.py 的存在,你可以将它复制到你安装的用于上述任何版本的 idlelib 中。