{"id":17990130,"url":"https://github.com/rdbende/tkinterdnd","last_synced_at":"2025-04-13T00:13:56.187Z","repository":{"id":43167513,"uuid":"379743342","full_name":"rdbende/tkinterDnD","owner":"rdbende","description":"A nice and easy-to-use wrapper around the tkdnd package","archived":false,"fork":false,"pushed_at":"2024-09-25T15:37:04.000Z","size":192,"stargazers_count":34,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T00:13:51.374Z","etag":null,"topics":["dnd","dragndrop","python","tkdnd","tkinter","tkinterdnd","ttk"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/python-tkdnd","language":"Tcl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rdbende.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-23T22:26:47.000Z","updated_at":"2025-01-04T18:05:15.000Z","dependencies_parsed_at":"2024-10-29T19:49:49.236Z","dependency_job_id":null,"html_url":"https://github.com/rdbende/tkinterDnD","commit_stats":{"total_commits":33,"total_committers":1,"mean_commits":33.0,"dds":0.0,"last_synced_commit":"4a17b171d34fb945ac7b7a28b5294db927180d2e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdbende%2FtkinterDnD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdbende%2FtkinterDnD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdbende%2FtkinterDnD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdbende%2FtkinterDnD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdbende","download_url":"https://codeload.github.com/rdbende/tkinterDnD/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647274,"owners_count":21139086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dnd","dragndrop","python","tkdnd","tkinter","tkinterdnd","ttk"],"created_at":"2024-10-29T19:16:48.354Z","updated_at":"2025-04-13T00:13:56.165Z","avatar_url":"https://github.com/rdbende.png","language":"Tcl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tkinterDnD\nA nice and easy-to-use wrapper around the tkdnd package. No tcl installation, no build is required, **just install and use it!**\n\n## Install\nThe Pypi name is python-tkdnd, because tkinterDnD was already taken, but you can import the package as `tkinterDnD`\n\n```\npip3 install python-tkdnd\n```\nor if you're using a distro like Windows 7, 10, or 11 replace `pip3` with `pip`\n\n\n## Credits\n```\nCopyright (c) 2021 rdbende\nCopyright (c) 2012-2020 Petasis - the tkdnd package\nCopyright (c) 2020 Philippe Gagné - for Mac binaries\nCopyright (c) 2017 Michael Lange - the TkinterDnD package\n```\n\n## Little example\n```python\nimport tkinter as tk\nfrom tkinter import ttk\nimport tkinterDnD  # Importing the tkinterDnD module\n\n# You have to use the tkinterDnD.Tk object for super easy initialization,\n# and to be able to use the main window as a dnd widget\nroot = tkinterDnD.Tk()  \nroot.title(\"tkinterDnD example\")\n\nstringvar = tk.StringVar()\nstringvar.set('Drop here or drag from here!')\n\n\ndef drop(event):\n    # This function is called, when stuff is dropped into a widget\n    stringvar.set(event.data)\n    \ndef drag_command(event):\n    # This function is called at the start of the drag,\n    # it returns the drag type, the content type, and the actual content\n    return (tkinterDnD.COPY, \"DND_Text\", \"Some nice dropped text!\")\n\n\n# Without DnD hook you need to register the widget for every purpose,\n# and bind it to the function you want to call\nlabel_1 = tk.Label(root, textvar=stringvar, relief=\"solid\")\nlabel_1.pack(fill=\"both\", expand=True, padx=10, pady=10)\n\nlabel_1.register_drop_target(\"*\")\nlabel_1.bind(\"\u003c\u003cDrop\u003e\u003e\", drop)\n\nlabel_1.register_drag_source(\"*\")\nlabel_1.bind(\"\u003c\u003cDragInitCmd\u003e\u003e\", drag_command)\n\n\n# With DnD hook you just pass the command to the proper argument,\n# and tkinterDnD will take care of the rest\n# NOTE: You need a ttk widget to use these arguments\nlabel_2 = ttk.Label(root, ondrop=drop, ondragstart=drag_command,\n                    textvar=stringvar, padding=50, relief=\"solid\")\nlabel_2.pack(fill=\"both\", expand=True, padx=10, pady=10)\n\n\nroot.mainloop()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdbende%2Ftkinterdnd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdbende%2Ftkinterdnd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdbende%2Ftkinterdnd/lists"}