amykyta3 / tclpython

Tcl package that provides access to a Python interpreter
GNU General Public License v3.0
15 stars 1 forks source link

Remove builtin Tcl sub-interpreter from Python interpreter #3

Closed amykyta3 closed 6 years ago

amykyta3 commented 7 years ago

Currently, tclpython automatically provides the tcl.eval() function in the Python namespace. This adds the ability to access a Tcl interpreter, from the Python interpreter, from the Tcl shell...

set interpreter [python::interp new]
puts [$interpreter eval {tcl.eval('clock format [clock seconds]')}]

Remove this feature for several reasons:

0beron commented 6 years ago

I have used tclpython in the past in conjunction with another application written in tcl/Tk. It starts a python interpreter using tclpython, and I make use of the injected tcl module to allow the python interpreter to call back up to the parent interpreter, (mostly drawing to canvas widgets). Am I right in understanding that the tkinter.Tcl() workaround will only allow me to evaluate inside another nested TCL interpreter, that is not the original one I started the application in?

It seems similar to the situation described at https://stackoverflow.com/questions/32549839/running-tcl-code-on-an-existing-tcl-shell-from-python , with the solution being to use Tcllib and a local network connection, however the old functionality of tclpython seemed a much tidier way of achieving this?

amykyta3 commented 6 years ago

Interesting point. You are correct that tkinter.Tcl() would not have access to the original Tcl interpreter.

When I adopted this project, I did a lot of refactoring on the original codebase and it was not immediately obvious that the old functionality was providing access back to the original interpreter. I'll look into re-enabling this feature since I see how it could be useful in some situations.

amykyta3 commented 6 years ago

Closing since feature request is now captured in #7