On 1/28/2021 5:53 AM, Robin Becker wrote:
I googled in vain for instances where parts of idlelib are re-used in a simplistic way. I would like to use the editor functionality in a tkinter window and also probably run code in a subprocess.

Are there any examples around that do these sorts of things?

turtledemo reuses IDLE's colorizer and read-only textviews. I have seen occasional hints on stackoverflow of other such uses.

One barrier to reuse is that the parts are highly interconnected, with numerous import loops. (Changing the form of some imports from 'import x' to 'from x import y' can make IDLE startup fail.) Some objects, like EditorWindow, are too monolithic. You cannot put a toplevel inside another toplevel.

Another, for those thinking long term, is that implementation modules in idlelib are defined as private since 3.6 (PEP-434, idlelib.__init__). I pushed for this in order to be able to refactor to reduce interconnections, and break some things apart, and also to switch to ttk widgets.

For instance, breaking EditorFrame apart from EditorWindow would allow me to put multiple editors on multiple tabs of a notebook in an application window. It would also allow others to put an editor window in their tkinter window.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to