I am writing a program that can dynamic display the process of bubble sort. My programme now can randomise the unsorted bars(rectangles) .But there is a problem came to me, when I start sorting, how to erase part of the rectangle and redraw them(aim to show the swap between two bars)?
Erasing is simply a matter of redrawing what is under the thing to be erased. In your case probably whatever is the background color.
···
On 1/16/13 7:40 PM, Shannon wrote:
Hi,
I am writing a program that can dynamic display the process of bubble
sort. My programme now can randomise the unsorted bars(rectangles) .But
there is a problem came to me, when I start sorting, how to erase part
of the rectangle and redraw them(aim to show the swap between two bars)?
Any suggestion?
I am writing a program that can dynamic display the process of bubble sort.
My programme now can randomise the unsorted bars(rectangles) .But there is a
problem came to me, when I start sorting, how to erase part of the
rectangle and redraw them(aim to show the swap between two bars)?
Any suggestion?
unless performance proves to be a problem, I'd just re-draw the entire
thing whenever there is a change.
If you want to get fancier, you may want to try wx.lib.floatcanvas,
which will give you nifty features like auto-scaling, etc. But it
looks like you're close.
-Chris
···
On Wed, Jan 16, 2013 at 7:40 PM, Shannon <shannonzheng5@gmail.com> wrote:
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception