Skip to content

wxPython 4.1.1, InitBuffer() error #1

Description

@univox360

I find the following issues on python 3.6 with wxPython 4.1.1

Your basic slm code:

`
import slmpy

import time

import numpy as np

slm = slmpy.SLMdisplay()

resX, resY = slm.getSize()

X, Y = np.meshgrid(np.linspace(0, resX, resX), np.linspace(0, resY, resY))
testIMG = np.round((2 ** 8 - 1) * (0.5 + 0.5 * np.sin(2 * np.pi * X / 50))).astype('uint8')

slm.updateArray(testIMG)

slm.close()
`

Gives the following error:

C:\Users\labuser\Miniconda3\python.exe C:/Users/labuser/PycharmProjects/opticalcompute/slmtest.py
C:\Users\labuser\PycharmProjects\opticalcompute\slmPy-master\slmpy.py:40: wxPyDeprecationWarning: Call to deprecated item EmptyImage. Use :class:Image instead.
self.img = wx.EmptyImage(2,2)
Traceback (most recent call last):
File "C:\Users\labuser\PycharmProjects\opticalcompute\slmPy-master\slmpy.py", line 59, in UpdateImage
self.InitBuffer()
File "C:\Users\labuser\PycharmProjects\opticalcompute\slmPy-master\slmpy.py", line 50, in InitBuffer
self.clientSize = self.GetClientSize()
RuntimeError: wrapped C/C++ object of type SLMframe has been deleted
Process finished with exit code -1073741819 (0xC0000005)

Fixing the depcrecation issue wx.EmptyImage(2,2) -> wx.Image(2,2) in "slmpy.py" stil gives:

C:\Users\labuser\Miniconda3\python.exe C:/Users/labuser/PycharmProjects/opticalcompute/slmtest.py
Traceback (most recent call last):
File "C:\Users\labuser\PycharmProjects\opticalcompute\slmPy-master\slmpy.py", line 59, in UpdateImage
self.InitBuffer()
File "C:\Users\labuser\PycharmProjects\opticalcompute\slmPy-master\slmpy.py", line 52, in InitBuffer
dc = wx.ClientDC(self)
RuntimeError: wrapped C/C++ object of type SLMframe has been deleted

Process finished with exit code -1073741819 (0xC0000005)

I am not too experienced with python or wxPython, so maybe the solution is obvious. Thanks.

-Elliot

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions