after an image is moved to a new location, how to delete the image at the old location?

Discussion in 'Python' started by zxo102, Aug 1, 2006.

  1. zxo102

    zxo102 Guest

    Hi everyone,
    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? 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
    zxo102, Aug 1, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HeroOfSpielburg
    Replies:
    1
    Views:
    387
    Alf P. Steinbach
    Aug 6, 2003
  2. Jef Driesen
    Replies:
    1
    Views:
    500
    Gernot Frisch
    Jan 19, 2005
  3. D
    Replies:
    3
    Views:
    684
    Mark Rae
    Sep 3, 2006
  4. John Henry
    Replies:
    24
    Views:
    1,006
    alex23
    May 30, 2008
  5. X X
    Replies:
    4
    Views:
    349
    red floyd
    Jul 19, 2010
Loading...

Share This Page