Browse Source

closes #286 - 2.7 / 3.0 wx bitmap creation compatibility

pull/473/head
Chris 6 years ago
parent
commit
6240e979c7
2 changed files with 7 additions and 3 deletions
  1. 4
      gooey/gui/imageutil.py
  2. 6
      gooey/gui/three_to_four.py

4
gooey/gui/imageutil.py

@ -6,7 +6,7 @@ import six
from PIL import Image from PIL import Image
import wx import wx
from gooey.gui.three_to_four import imageFromBitmap, bitmapFromImage
from gooey.gui.three_to_four import bitmapFromBufferRGBA
@ -25,7 +25,7 @@ def wrapBitmap(im, parent):
except AttributeError: except AttributeError:
rgba = im.convert('RGBA').tostring() rgba = im.convert('RGBA').tostring()
bitmapData = wx.Bitmap.FromBufferRGBA(im.size[0], im.size[1], rgba)
bitmapData = bitmapFromBufferRGBA(im, rgba)
return wx.StaticBitmap(parent, bitmap=bitmapData) return wx.StaticBitmap(parent, bitmap=bitmapData)

6
gooey/gui/three_to_four.py

@ -43,5 +43,9 @@ def bitmapFromImage(image):
return wx.BitmapFromImage(image) return wx.BitmapFromImage(image)
def bitmapFromBufferRGBA(im, rgba):
if isLatestVersion:
return wx.Bitmap.FromBufferRGBA(im.size[0], im.size[1], rgba)
else:
return wx.BitmapFromBufferRGBA(im.size[0], im.size[1], rgba)
Loading…
Cancel
Save