I've spent some time to search for workable solution to do Drag and Drop behavior with Python Tkinter on OSX platform, and the most possible solution found is TkDnD library. http://sourceforge.net/projects/tkdnd/files/
However I cannot find any manual or guide about the installation and basically no sample on OSX. Can anyone share their experience with me?
Furthermore, is it not a good choice to use Tkinter as a GUI solution? My users are all OSX platform and Python is preinstalled on all these machines. Any good suggestion to find a native GUI support without additional installation? PyQT seems to be another choice, but not sure if it requires the additional installation on Client machine.
I spent a few days to figured out how to install TkDnD lib, although it sounds like an easy question but did confused me a little while.
Two ways to install TkDnD on OSX:
A. Copy to /System/Library/Tcl/8.x
:
OSX preinstalled Python already, and this is the path where Tcl library is installed. TkDnd lib will be loaded automatically while using Tk/Tcl lib.
B. Set os.environ['TKDND_LIBRARY']
to the location of TkDnd2.x.dylib:
Sample code:
if sys.platform == 'win32':
if getattr(sys, 'frozen', False):
os.environ['TKDND_LIBRARY'] = os.path.join(os.path.dirname(sys.executable), 'tkdnd2.7')