11

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

Alex
  • 43,191
  • 44
  • 96
  • 127

2 Answers2

18
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
  • 8,749
  • 6
  • 30
  • 44
Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
7
self.png = wx.StaticBitmap(self, -1, wx.Bitmap("path/image.png", wx.BITMAP_TYPE_ANY))
Didier Ghys
  • 30,396
  • 9
  • 75
  • 81
Xen Non
  • 91
  • 1
  • 3