Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag and Drop in Tkinter?

What is the correct/official/proper/recommended way of accomplishing drag/drop in tkinter? My documentation section 24.1.1 includes:

Tkdnd Drag-and-drop support for Tkinter. This is experimental and should become deprecated when it is replaced with the Tk DND.

but I can find no other official documentation. Does Tkinter have drag/drop support at all? Is this something version dependant? Is this something not yet included in tk(tcl) which will then filter through to tkinter?

I should stress that I am talking about drag/drop between different applications and that I am currently using python 2 (although any solution which relies on python 3 would still be of interest).

like image 558
Richard Avatar asked Apr 22 '13 09:04

Richard


People also ask

How do you add drag and drop in Python?

However, the simplest way to enable dragging from a widget is to reimplement the widget's mousePressEvent() and start a drag and drop operation: def mousePressEvent(self, event): if (event. button() == Qt. LeftButton and iconLabel.

Is there a drag and drop GUI for Python?

PAGE is an drag-and-drop GUI generator, bearing a resemblance to Visual Basic. It allows one to easily create GUI windows containing a selection of Tk and ttk widgets. Use it to build GUIs in Python and Tcl/tk. But before you install it you must download Activestate Tcl/tk software.

Is there a designer for tkinter?

Tkinter Designer was created to speed up the GUI development process in Python. It uses the well-known design software Figma to make creating beautiful Tkinter GUIs in Python a piece of cake 🍰 . Tkinter Designer uses the Figma API to analyse a design file and create the respective code and files needed for the GUI.


1 Answers

Tkinter has no built-in support for dragging and dropping between applications. Tkdnd is, AFAIK, the only way to accomplish it without writing the low level code yourself.

like image 149
Bryan Oakley Avatar answered Oct 30 '22 10:10

Bryan Oakley