def piltowx(pil): wxi = wx.EmptyImage(*pil.size) wxi.SetData(pil.copy().convert('RGB').tobytes()) return wxi