why don't you build wheel for the package and publish it at pypi for easy installing?
following this to build a wheel and upload it for easy install via pip install instead of all of these Stackoverflow issues can make as all a life much easier and can get your handy extension very popular. why don't you do it?
Because I don't know how :-)
the thing with this lib is that its include also binaries and not only python files. you need to include them in the wheel somehow using setup.py. i almost succided. but you need to update your TkinterDnD.py file with some extra logic so setup.py would know to add this dll to the wheel build. see https://stackoverflow.com/a/31495246/10577976 for great example
for complete reference see https://packaging.python.org/guides/distributing-packages-using-setuptools/ an official example: https://github.com/pypa/sampleproject
also published a stackoverflow question: https://stackoverflow.com/questions/66471737/how-to-publish-python-package-by-wheel-with-extra-tcl-filestkdnd
hey friend. I try to understand how you call you lib in such way that tk can use your tcl extensions? if you can help me with that i could help you build a proper wheel
Hi,
If I understand your question, you are asking where the library (binaries + tcl code) can be installed. TkInter when installed uses a Tcl installation. TkDND must be installed inside the lib dir of this installation. Another way is to modify Tcl's path for searching packages. What do you think will be easier?
Thus, the first alternative is to install to tcl/binary part at the path returned by:
from tkinter import Tcl
tcl = Tcl()
print(tcl.call('info', 'library'))
Which in my system prints: /opt/ActiveTcl-8.6/lib/tcl8.6
The second alternative is to install it where Tcl puts packages in the system, and extend Tcl's "auto_path" global variable.
from tkinter import Tcl
tcl = Tcl()
print(tcl.call('info', 'library'))
print(tcl.call('set', '::auto_path'))
In my system it prints: ('/opt/BAWT/Tcl/lib', <path object: '/opt/ActiveTcl-8.6/lib/tcl8.6'>, '/opt/ActiveTcl-8.6/lib', '/usr/lib')
Of course there is also the alternatives to install the binary where python install packages, and update Tcl's auto_path.
so I still don't understand how Tkinter knows to load tkdnd2.9.2 folder in the tcl directory. if I will remove this folder I won't be able to run the tkdnd python wrapper and it will fail with 'Unable to load tkdnd library' error. how does python/tcl knows to load this folder?
apparently, someone successfully improved your code and build a successful setup.py file! see: https://github.com/pmgagne/tkinterdnd2
thank you.