Stopped using deprecated objects when Loading images due to WX 4

This commit is contained in:
Manuel Cortez 2018-09-03 10:00:23 -05:00
parent d45bfb0eeb
commit 2a5a184662

View File

@ -185,10 +185,10 @@ class postController(object):
url = self.get_photo_url(self.images[index]["photo"], "x") url = self.get_photo_url(self.images[index]["photo"], "x")
if url != "": if url != "":
img = requests.get(url) img = requests.get(url)
image = wx.ImageFromStream(cStringIO.StringIO(requests.get(url).content)) image = wx.Image(stream=cStringIO.StringIO(requests.get(url).content))
try: try:
self.dialog.image.SetBitmap(wx.BitmapFromImage(image)) self.dialog.image.SetBitmap(wx.Bitmap(image))
except: except NameError:
return return
self.dialog.SetClientSize(self.dialog.sizer.CalcMin()) self.dialog.SetClientSize(self.dialog.sizer.CalcMin())
# Translators: {0} is the number of the current photo and {1} is the total number of photos. # Translators: {0} is the number of the current photo and {1} is the total number of photos.