10

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

Alex
  • 37,703
  • 43
  • 90
  • 124

2 Answers2

16
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

Stano
  • 7,265
  • 6
  • 26
  • 41
Ned Batchelder
  • 323,515
  • 67
  • 518
  • 625
6
self.png = wx.StaticBitmap(self, -1, wx.Bitmap("path/image.png", wx.BITMAP_TYPE_ANY))
Didier Ghys
  • 29,364
  • 9
  • 67
  • 76
Xen Non
  • 81
  • 1
  • 3