## TkinterDnD2
[Eliav2/tkinterdnd2](https://github.com/Eliav2/tkinterdnd2) is a fork of the (unmaintained) [pmgagne/tkinterdnd2](https://github.com/pmgagne/tkinterdnd2) which is a python wrapper for [tkdnd](https://github.com/petasis/tkdnd) .
This repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with `pip install tkinterdnd2`.
This repository is being maintained to ensure availability of `tkinterdnd2` into the future.
## Install
`python -m pip install tkinterdnd2`
## Usage
```python
import tkinter as tk
from tkinterdnd2 import DND_FILES, TkinterDnD
root = TkinterDnD.Tk() # notice - use this instead of tk.Tk()
lb = tk.Listbox(root)
lb.insert(1, "drag files to here")
# register the listbox as a drop target
lb.drop_target_register(DND_FILES)
lb.dnd_bind('<<Drop>>', lambda e: lb.insert(tk.END, e.data))
lb.pack()
root.mainloop()
```
![tkinterdnd2 example usage](https://i.stack.imgur.com/jnOWd.png)
see any of the [demos](./demos) for usage examples.
# tkinterdnd2
Tkinter native drag and drop support for windows, unix and Mac OSX.
## What is TkinterDnD2
[TkinterDnD2](http://tkinterdnd.sourceforge.net) is a python wrapper for George Petasis' tkDnD Tk extension version 2.
It is a domain public project.
## What is TkDnD2
[tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
## What this repository is about
This repo package TkinterDnD2 and tkdnd2 into a standard python module.
When the extension is imported in python its location will be automatically added to the Tk search path.
This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
## pyinstaller
When using `pyinstaller`, you should use the hook-tkinterdnd2.py file included to collect the TkDnD binaries and build them into the project. To use it, copy it into the base directory of your project, then run pyinstaller as follows:
pyinstaller -F -w myproject/myproject.py --additional-hooks-dir=.
Raw data
{
"_id": null,
"home_page": "https://github.com/Eliav2/tkinterdnd2",
"name": "tkinterdnd2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "petasis\\pmgagne\\eliav2",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b9/1e/71477ee1115fbb49b6e3a03b789c62923d3528205659d47e54df7165e4a9/tkinterdnd2-0.4.0.tar.gz",
"platform": null,
"description": "## TkinterDnD2\n\n[Eliav2/tkinterdnd2](https://github.com/Eliav2/tkinterdnd2) is a fork of the (unmaintained) [pmgagne/tkinterdnd2](https://github.com/pmgagne/tkinterdnd2) which is a python wrapper for [tkdnd](https://github.com/petasis/tkdnd) . \n\nThis repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with `pip install tkinterdnd2`.\n\nThis repository is being maintained to ensure availability of `tkinterdnd2` into the future.\n\n## Install\n\n`python -m pip install tkinterdnd2`\n\n## Usage\n\n```python\nimport tkinter as tk\n\nfrom tkinterdnd2 import DND_FILES, TkinterDnD\n\nroot = TkinterDnD.Tk() # notice - use this instead of tk.Tk()\n\nlb = tk.Listbox(root)\nlb.insert(1, \"drag files to here\")\n\n# register the listbox as a drop target\nlb.drop_target_register(DND_FILES)\nlb.dnd_bind('<<Drop>>', lambda e: lb.insert(tk.END, e.data))\n\nlb.pack()\nroot.mainloop()\n```\n![tkinterdnd2 example usage](https://i.stack.imgur.com/jnOWd.png)\n\n\nsee any of the [demos](./demos) for usage examples.\n\n# tkinterdnd2\n\nTkinter native drag and drop support for windows, unix and Mac OSX.\n\n## What is TkinterDnD2\n\n[TkinterDnD2](http://tkinterdnd.sourceforge.net) is a python wrapper for George Petasis' tkDnD Tk extension version 2.\n\nIt is a domain public project.\n\n## What is TkDnD2\n\n[tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.\n\n## What this repository is about\n\nThis repo package TkinterDnD2 and tkdnd2 into a standard python module.\n\nWhen the extension is imported in python its location will be automatically added to the Tk search path.\n\nThis repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.\n\n## pyinstaller\n\nWhen using `pyinstaller`, you should use the hook-tkinterdnd2.py file included to collect the TkDnD binaries and build them into the project. To use it, copy it into the base directory of your project, then run pyinstaller as follows:\n\n pyinstaller -F -w myproject/myproject.py --additional-hooks-dir=.\n",
"bugtrack_url": null,
"license": null,
"summary": "TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/Eliav2/tkinterdnd2"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ccaa9eec659e105f575064192a83ebf21eb429867aa21e65fec03ff486d2abaf",
"md5": "f5b4650790330d1d1f97c87bfcdf5281",
"sha256": "d6d5003d38b20c63fc729bc403b69b9e7e2d4a81052bc75dccff68e3056d2ac7"
},
"downloads": -1,
"filename": "tkinterdnd2-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f5b4650790330d1d1f97c87bfcdf5281",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 492702,
"upload_time": "2024-07-31T11:11:31",
"upload_time_iso_8601": "2024-07-31T11:11:31.261564Z",
"url": "https://files.pythonhosted.org/packages/cc/aa/9eec659e105f575064192a83ebf21eb429867aa21e65fec03ff486d2abaf/tkinterdnd2-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b91e71477ee1115fbb49b6e3a03b789c62923d3528205659d47e54df7165e4a9",
"md5": "0861790859ecf86bd1f2407f6bc49d70",
"sha256": "cfb1e610512f5d5d0386fb92cf39f8689351235e504fd3c5b0b99dbbc57391ef"
},
"downloads": -1,
"filename": "tkinterdnd2-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "0861790859ecf86bd1f2407f6bc49d70",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 443959,
"upload_time": "2024-07-31T11:11:33",
"upload_time_iso_8601": "2024-07-31T11:11:33.209490Z",
"url": "https://files.pythonhosted.org/packages/b9/1e/71477ee1115fbb49b6e3a03b789c62923d3528205659d47e54df7165e4a9/tkinterdnd2-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-31 11:11:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Eliav2",
"github_project": "tkinterdnd2",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "tkinterdnd2"
}