-1

I am trying to create a GUI in python, where the output is a window which has buttons and these buttons we can pick and place in a desired location on the window, at the same time the button is also available for the user to pick again. Example: the image shows that the person can drag the buttons and the button is also available

is there any option to do this in python ? I searched a lot...I was able to find option for just drag and drop but i was not able to find anything for cloning of the dragged widget... I am trying to create a gui which is kind of similar to https://studio.code.org/projects/applab/1NP-J2tjpgN7FADHvU7qc5dMFfxqCaEV0CrtKmHc4YM/edit

Any help would be great. Thanks!!

1 Answers1

0

Answers from two similar stackoverflow solved this.

Drag and drop - Drag and Drop widgets tkinter

Cloning (making multiple copies of the button) - Answer given by Bryan Oakley in Is there a way to clone a tkinter widget? There is no direct way to clone a widget, but tkinter gives you a way to determine the parent of a widget, the class of a widget, and all of the configuration values of a widget. This information is enough to create a duplicate. It would look something like this:

def clone(widget):
    parent = widget.nametowidget(widget.winfo_parent())
    cls = widget.__class__
    clone = cls(parent)
    for key in widget.configure():
        clone.configure({key: widget.cget(key)})
    return clone

Thanks!!