user1008537
user1008537

Reputation:

Delete image in wxpython?

I know this sounds easy but how can i delete a image with wxpython?

I am using wx.StaticBitmap and wx.Image to create the image, but is there a way to delete an image?

Maybe theres something like this:

bmp1 = wx.Image(filename, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.bitmap1 = wx.StaticBitmap(self.sizer, -1, bmp1, (0, 0))
delete_image(self.bitmap1)
delete_image(bmp1)

I have tried replacing the variable but the image still shows.

Upvotes: 2

Views: 2934

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33101

self.bitmap1.Hide() or self.bitmap1.Destroy(). The first will just hide it whereas the second will actually destroy the widget. You'll probably want to call self.Layout() to make your window redraw and update the layout of your widgets.

Upvotes: 5

Related Questions