Search code examples
pygtk

I want to Click , Drag and Move a button on the pygtk window


I managed to find a sample code for Images as described in the following link .

How to drag images with pygtk

However when I use it for a button doesn't seem to work .


Solution

  • What the original link does:

    It moves (pans) the image inside a 'Scrolled Window' widget. The widget doesn't change places, only the image with respect to the widget.

    If you want to move the button itself, that is more complicated! It is easier if you use the 'fixed' layout manager, where the buttons are located in absolute coordinates (as opposed to the 'normal' layout manager where all widgets are 'packed' alongside each other. There you should use drag and drop. You have to prepare the entire application for 'receiving' the button, and what to do with it when it gets there. This involves many steps! ).

    Have a look at the gtk.Fixed widget's documentation.