Alex
Alex

Reputation: 44709

Showing a .png image in a window in wxPython

How to show a .png image in a window in wxPython?

Upvotes: 11

Views: 26117

Answers (2)

Ned Batchelder
Ned Batchelder

Reputation: 375484

png = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
wx.StaticBitmap(self, -1, png, (10, 5), (png.GetWidth(), png.GetHeight()))

Longer sample: http://web.archive.org/web/20090823114922/http://www.daniweb.com/code/snippet337.html

Upvotes: 18

Xen Non
Xen Non

Reputation: 91

self.png = wx.StaticBitmap(self, -1, wx.Bitmap("path/image.png", wx.BITMAP_TYPE_ANY))

Upvotes: 7

Related Questions