after an image is moved to a new location,
how to delete the image at the old location?
zxo102
zxo102 at yahoo.com
Tue Aug 1 19:07:37 PDT 2006
Hi everyone,
I need your help. What I want to do is to move an image around based on location data in wxpython.
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.
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).
Anybody knows how to solve the above problem? or is there other way to implement it?
Thanks a lot.
Ouyang
#############################################
def runTest(frame, nb, log):
bmp = wx.Image(opj('bitmaps/image.bmp'), wx.BITMAP_TYPE_BMP)
bmp.SetMask(True)
# image.bmp is originally located in (50,10) with rotated angle
1.12
x = 50
y = 10
angle = 1.12
bmp1 = bmp.Rotate(angle, (x,y), True,None)
bmp1 = bmp1.ConvertToBitmap()
panel = wx.Panel(nb, -1)
kk = wx.StaticBitmap(panel, -1, bmp1, (x, y), (bmp1.GetWidth(),
bmp1.GetHeight()))
# Now image.bmp is relocated at (166,400) with rotated angle 1.5
x= 166
y = 400
angle = 1.5
bmp2 = bmp.Rotate(angle, (x,y), True,None)
bmp2 = bmp2.ConvertToBitmap()
wx.StaticBitmap(panel, -1, bmp2, (x,y), (bmp2.GetWidth(),
bmp2.GetHeight()))
#kk.SetBitmap(bmp2)
return panel
###########################################################3
---------------------------------
How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20060801/4f9b6be6/attachment.htm
More information about the wxpython-users
mailing list