[wxPython-users] after an image is moved to a new location, how to delete the image at the old location?

Christopher Barker Chris.Barker at noaa.gov
Tue Aug 1 21:39:40 PDT 2006


zxo102 wrote:
>      As shown in the code below (modified based on the Image.py in
> wxpython demo), an image is created at location 1:  (50,10) with
> rotated angle 1.12.  Now, suppose I got another set of new data, I want
> to move the image to location 2:  (166,400) with rotated angle 1.5.
> case 1:
>      if I use
>      "wx.StaticBitmap(panel, -1, bmp2, (166, 400), (bmp2.GetWidth(),
> bmp2.GetHeight()))",
>      everything is fine but I don't know how to delete the image at
> location 1.

you can delete with kk.Destroy()

> case 2:
>      If I use
>      "kk.SetBitmap(bmp2)" (see the code below),
>      the rotated image (angle 1.5) is put to location 1: (50,10)
> instead of location 2: (166,400). Or I don't know how to move the image
> to the new location (166,400).

kk.Move((166,400))

I'd do that, no reason to destroy one and make another.

You might also want to consider just drawing the Bitmap to Window with a 
wx.DC -- see the Wiki and/or the demo for examples.

Also, depending on what else you want wx.lib.floatcanvas may will give 
you a lot more features.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception




More information about the wxpython-users mailing list