Drag button between panels in wxPython

2019-06-07 05:06发布

问题:

Does anyone know of an example where it is shown how to drag a button from one panel to another in wxPython?

I have created a bitmap button in a panel, and I would like to be able to drag it to a different panel and drop I there.

I haven't found any examples using buttons, just text and files.

I am using the latest version of Python and wxPython.

回答1:

If you want to graphically represent the drag, one good way to do this is to create a borderless Frame that follows the mouse during a drag. You remove the button from your source Frame, temporarily put it in this "drag Frame", and then, when the user drops, add it to your destination Frame.