ipython icon indicating copy to clipboard operation
ipython copied to clipboard

Issues Integrating CustomTkinter

Open MrHemlock opened this issue 1 year ago • 1 comments
trafficstars

I've been struggling trying to get CustomTkinter behaving in the same way as %gui tk. The issue is that when you try to instantiate the root window, even if you have the %gui tk activated, it doesn't pop up, and running the .main_loop() method is blocking, so I'm unable to use the terminal until I kill the window that pops up then. There are some things in the docs that I can't seem to find within the IPython library. Specifically in the "Integrating with GUI event loops" page:

https://ipython.readthedocs.io/en/stable/config/eventloops.html#integrating-with-a-new-event-loop-in-the-kernel

It mentions IPython.kernel.zmq.kernelbase.Kernel.do_one_iteration() and IPython.kernel.zmq.eventloops.register_integration(), both of which I cannot find anywhere. But looking at the actual hook that is in the py_inputhooks/tk.py file doesn't have or use those.

CustomTkinter does use the tkinter under the hood (hence the name), and I was hoping that I could easily get that hooked in and working easily. However I've just hit a wall and I can't figure out how to do it. Are there any tips or things that I'm missing? Apologies if this is a dumb question.

MrHemlock avatar Jul 26 '24 19:07 MrHemlock

If you're using IPython in the terminal (running the command ipython to start it), then look at the Integrating with a new event loop in the terminal section in the docs.

The 'kernel' in this context means IPython acting as a backend for Jupyter frontends. The IPython.kernel subpackage was moved out to a separate ipykernel package, so if that's what you're interested in, the relevant code is now here: https://github.com/ipython/ipykernel/blob/main/ipykernel/eventloops.py

takluyver avatar Aug 27 '24 11:08 takluyver