[wxPython] Dragging Panels

In the wxPython demo there is an example of dragging images around a canvas.

Are you talking about the OGL demo? It's the only demo I know of that
has that feature, but I havn't downloaded a new one for a while.

I was actually eluded to the DragImage.py demo. It uses bitmaps and device contexts to move around a window.

I was wondering if a similar thing can be done with wxPanels. I'd like to put a small panel in a window and be able to drag it to a new position. Is there something fundamental overwhelmingly difficult or stupid with this concept?

Well, unless something new has appeared, it probably would be difficult
to do eith wxPython, at least if you want it smooth and fast. OGL has
the dragging part written in C++, so it's fast. Writing all that moving
and re-drawing in Python would probably be pretty slow.

What you can hope for is the new wxCanvas class, which is under
development. It's hard to know how long it will be before it is usable,
or what features it will have, but being able to quickly and smoothly
drag objects around a canvas should be one of them, and using wxWindows
GUI elements (panels, buttons, etc) as objects is also on the list.

If you have C++ skill, and want to contribute, I'm sure your help would
be appreciated. Check out the wx-devel list to find out how.

My C++ skill is not up to this task.

If you do figure out a way to get it smooth and fast with Python, let us
know!

I've tried a few things like grabbing a panel on mousedown and using the OnMotion event but if you move too fast and the mouse leaves the panel it stops.

Nigel

ยทยทยท

------------------------------------------------------------
--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users