A python tkinter drag and drop system.
Project description
# tkinterDnD Tkinter Drag-N-Drop module. Import this module with `python import tkinterDnD as dnd ` To make a widget draggable, do `python dnd.make_draggable(widget) ` To make a draggable widget inside a frame, do `python dnd.make_draggable(frame) dnd.make_draggable_component(widget) ` Here’s an example of this module being put to use. `python import tkinter import tkinterDnD as dnd tk = tkinter.Tk() tk.title("tkinterDnD") frame = tkinter.Frame(tk, bd=4, height=64, width=64, bg="red") frame.place(x=0,y=0) dnd.make_draggable(frame) label = tkinter.Label(frame, text="Hello", bg="red", wraplength=64, justify=tkinter.CENTER) label.config(highlightbackground="black") label.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER) dnd.make_draggable_component(label) frame = tkinter.Frame(tk, bd=4, height=64, width=64, bg="green") frame.place(x=0,y=0) dnd.make_draggable(frame) label = tkinter.Label(frame, text="World", bg="green", wraplength=64, justify=tkinter.CENTER) label.config(highlightbackground="black") label.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER) dnd.make_draggable_component(label) tk.mainloop() ` # Side note: The module has a default snap grid of 16x16 units.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file tkinterDnD-0.0.0.tar.gz.
File metadata
- Download URL: tkinterDnD-0.0.0.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
613f81e1118985c36a3fdcfc7d23206938d7e44f9734ac351ec71ef987096fba
|
|
| MD5 |
b6d1d9d34caf31592635d23e7416b565
|
|
| BLAKE2b-256 |
a22a8d2e5d6f352aa286cfb43dcca516753b8d85144897fd8b4e5706f308dff0
|