[wxPython] Dragging Panels

In the wxPython demo there is an example of dragging images around a canvas. 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?

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

nw_moriarty us wrote:

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 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.

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

-Chris

···

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

--
Christopher Barker,
Ph.D.
cbarker@jps.net --- --- ---
http://www.jps.net/cbarker -----@@ -----@@ -----@@
                                   ------@@@ ------@@@ ------@@@
Water Resources Engineering ------ @ ------ @ ------ @
Coastal and Fluvial Hydrodynamics ------- --------- --------
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

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.

He was probably talking about the wxDragImage demo.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxPython.org Java give you jitters?
http://wxPROs.com Relax with wxPython!

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

nw_moriarty us wrote:

In the wxPython demo there is an example of dragging images around a canvas. 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?

Nigel

I'm doing this in Boa Constructor, so it is definitely possible, but
it was a bit tricky.
If you want to look at the source it's mostly in Views\SelectionTags.py
and a little bit in Views\Designer.py

Don't worry too much about the speed; currently I'm moving around 12
panels per selection :wink:

···

--
Riaan >>> a='a=%s;a%%`a`';a%`a`
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
     http://boa-constructor.sourceforge.net
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

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

canvas. 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?

Nope. Look at wxPython/lib/floatbar.py for a similar concept. Basically
your panel would need to catch mouse events, OnMouseDown would capture the
mouse, OnMouseUp release the mouse, and OnMouseDrag would move the panel
based upon the coordinants of the previous event and the coordinants of
where the mouse is now.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxPython.org Java give you jitters?
http://wxPROs.com Relax with wxPython!

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