hi everyone,
I'm a newbie to wxpython programming, I know how to draw shapes(lines, rectangles etc) on the drawingarea widget at runtime, but cannot control each shapes after it has been drawn. eg. draw a rectangle on the screen then afterward, select it with the mouse and adjust its size or move it to another location within the exposed area. (like how one can draw shapes and edit them in archicad). and whenever i draw a new one, the prevous disappears.
thanks in advance.
drawing shapes
Re: drawing shapes
This is something you have to do implement in your code.
Basically, you keep a list of shapes with their coordinates on the canvas.
If the user starts a dragging operation, you iterate through the list to find the shape under the mouse cursor.
While the user drags, you update the position of that shape in your internal list accordingly and redraw the whole scene.
Basically, you keep a list of shapes with their coordinates on the canvas.
If the user starts a dragging operation, you iterate through the list to find the shape under the mouse cursor.
While the user drags, you update the position of that shape in your internal list accordingly and redraw the whole scene.
Use the source, Luke!
Re: drawing shapes
wxAtrt2D and wxShapeView may also help ( http://wiki.wxwidgets.org/WxFAQ#How_can ... d_nodes.3F ) though I am not sure if they can be used from wxPython. I suggest you go through the wxPython demo, I seem to remember that it contained some pre-made components from which you could maybe start
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows
-
- In need of some credit
- Posts: 2
- Joined: Thu Jan 03, 2013 2:29 pm
Re: drawing shapes
thanks, am on it now. will get back to youdoublemax wrote:This is something you have to do implement in your code.
Basically, you keep a list of shapes with their coordinates on the canvas.
If the user starts a dragging operation, you iterate through the list to find the shape under the mouse cursor.
While the user drags, you update the position of that shape in your internal list accordingly and redraw the whole scene.