Open HannesWell opened 2 weeks ago
Looks like we can use PCbuild/prepare_tcltk.bat for that on Windows: https://github.com/python/cpython/blob/main/PCbuild/readme.txt
Thanks for the pointer. This looks promising. I'll look into it. Do you have any immediate hints where this could maybe applied in the cpython preset?
I'm guessing somewhere before calling build.bat here: https://github.com/bytedeco/javacpp-presets/blob/master/cpython/cppbuild.sh#L189
When using Python's tkinter directly or indirectly a local installation of
tcl
andtk
is necessary. And while JavaCPP's cPypthon includes thetkinter
module it doesn't contain tcl/tk.Installing tcl/tk via
PIP
or alike is not possible. On Windows the CPython can install tcl/tk as part of the python installation and on Linux it can be installed via apt-get and is often already available: https://stackoverflow.com/questions/69603788/how-to-pip-install-tkinterTherefore I would like to suggest to include tcl/tk into JavaCPP's cpython-preset for Windows. Without that the following Python program cannot be executed using javacpp-embedded-python:
A workaround is to wrap the tcl folder of a 'classic' Cpython installation and distribute and cache it along with javacpp-cpython and run the following as first steps after the initialization of python (e.g. via
Py_Initialize()
):That's possible, but cumbersome and not easy to get to if one is not deeply familiar with the topic.
Unfortunately I cannot tell yet how including tcl/tk could be achieved, since I haven't fully understood yet how the CPython installer bundle tcl/tk.