Draw rectangle on a Window DC
Dennis Lee Bieber
wlfraed at ix.netcom.com
Mon Oct 21 17:21:49 EDT 2002
Anand fed this fish to the penguins on Monday 21 October 2002 07:01 am:
> Hi
>
> I need to draw a rectangle when the user selects an area
> over a wxPanel containing a wxStaticBitmap. The rectangle shoud change
> in size according to the dragging of the mouse.
>
I have no idea of the features of wx* but...
> How do I write the event processing code so that I dont have many
> rectangles overlapping each other, but just one that keeps changing
> size ?
>
The general technique for "rubber band" lines is to draw with an
exclusive-or operator. Then, before updating position, you redraw on
the old coordinates.
> The code I have right now,
>
> if event.Dragging():
>
somewhere in here you need to redraw/erase the old box, THEN get the
new
> self.endpt = event.GetPosition()
> w = (self.endpt.x - self.stpt.x) # stpt is stored
> in earlier
> # left mouse
> # click.
--
> ============================================================== <
> wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed at dm.net | Bestiaria Support Staff <
> ============================================================== <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <
More information about the Python-list
mailing list