I work a lot on Pure Data, an app written in Tcl/Tk and C. I’d like to be able to make a python API for plugins for modifying the Tcl/Tk GUI. To do this, it seems that I would need to be able to pass the running Tk instance to python, then have Tkinter use that Tcl/Tk instance for its commands. So something like:
root = Tk(pid_of_running_app)
Take a look at the send command, you can do exactly that (to Tk applications, not plain Tcl applications). I do this all the time from my Emacs (connect to running Tk applications).
Tcl/Tk won’t let you enslave another process, however using the
sendcommand, you can easily send over any commands you want to. Just find the “name” of the other interpreter by using[winfo interps](note: the name of your Tk application can be gotten/set by[tk appname]. At which point, any command you want to have executed in the other interpreter would be sent over by evaluating