draw a line to cursor

Hi all,

I am trying to do a relatively easy task... Draw a line from a static
spot on the canvas to my cursor and have it follow the cursor wherever
it goes. I was able to do this by using the wxDC function DrawLine()
and a redraw it everytime the event OnMotion is called. The problem
arises when I draw it I must Refresh() everytime in order to eliminate
the old line from the canvas. This causes a very sluggish motion and
redrawing. Is there any faster way to do this or possibly a built in
wrapper that I am not aware of?
Thanks

-Cole

Cole Harris
Enterasys Networks
Phone: 978-684-1652
Email: coharris@enterasys.com
www. http://www.enterasys.com

···

-----Original Message-----
From: Peter Damoc [mailto:pdamoc@gmx.net]
Sent: Thursday, September 01, 2005 9:24 AM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] a weird refresh problem

On Thu, 01 Sep 2005 15:47:48 +0300, MICHAEL A KOLAKOWSKI <mkolakowski@unmc.edu> wrote:

Hey...I noticed no-one replied to this yet. Now, I don't feel like

I'm

qualified enough to give advice, but given the previous statement, I
figured it couldn't hurt. Anyhow, we have some weird refresh problems

in

our application too. Some of them seem to deal with notebooks. We

often

use freeze() and thaw() to surround certain code that is doing

something

or changing the gui. Have you tried this?

I've tried it but it didn't worked... anyway... in the end I managed to

eliminate the problem by replacing the full panel refresh with smaller
refreshes :smiley:
Thanks for the tip anyway... there are places where freeze/thaw works
beautifuly

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Harris, Cole wrote:

Hi all,

I am trying to do a relatively easy task... Draw a line from a static
spot on the canvas to my cursor and have it follow the cursor wherever
it goes. I was able to do this by using the wxDC function DrawLine()
and a redraw it everytime the event OnMotion is called. The problem
arises when I draw it I must Refresh() everytime in order to eliminate
the old line from the canvas. This causes a very sluggish motion and
redrawing. Is there any faster way to do this or possibly a built in
wrapper that I am not aware of?
Thanks

-Cole

Draw it using a "reversible" function, then undraw it before drawing the next one.

e.g. wxDC.SetLogicalFunction (wxINVERT)
Then when you "undraw" it (i.e. draw it the second time) you reverse the original effect.
.

···

--
Alex Tweedly http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005