Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Moving mouse pointer into wxPython app's window causes C++ exception

Open a3an-de opened this issue 4 years ago • 1 comments

Operating system: Window 10 Pro wxPython version & source: 4.1.1 Python version & source: 3.9.1

Description of the problem: The problem occurs in this scenario:

  1. A wxPython app is started, cursor is moved outside the app's window
  2. The system goes to sleep, for instance by closing the lid of a laptop
  3. The lid is opened again, Windows sign-in is performed
  4. The pointer is moved into the app's window and the following exception is raised:

--- Start of exception report wx._core.wxAssertionError: C++ assertion “(argtype & (wxFormatStringSpecifier::value)) == argtype” failed at C:\PROJECTS\bb2\dist-win64-py39\build\ext\wxWidgets\include\wx/strvararg.h(484) in wxArgNormalizer::wxArgNormalizer(): format specifier doesn’t match argument type

The above exception was the direct cause of the following exception:

SystemError: <class ‘wx._core.MouseEvent’> returned a result with an error set --- End of exception report

The last line of the exception report sometimes is: SystemError: <class 'property'> returned a result with an error set

The example app I am using is a heavily scaled down version of a larger OpenGL application, it is actually doing nothing other than creating a Window and setting up a few event handlers. The app is started within the PyCharm IDE environment. Often, the full OpenGL app is terminating when this situation occurs, which is irritating indeed.

__

Code Example (click to expand) ``` import wx

class MainFrame(wx.Frame):

def __init__(self):
    wx.Frame.__init__(self, None, title="C++Bug ?", id=4711, size=(500, 300))

    self.Bind(wx.EVT_SIZE, self.onSize)
    self.Bind(wx.EVT_PAINT, self.onPaint)

    self.Bind(wx.EVT_MOTION, self.onMotion)

def onSize(self, ev):
    print('OnSize()')

def onMotion(self, ev):
    # print('onMotion()')
    pass

def onPaint(self, event):
    print('onPaint')

def OnQuit(self):
    print('MainFrame() OnQuit')

if name == "main": app = wx.App() frame = MainFrame() frame.Show() app.MainLoop()

</details>

a3an-de avatar Feb 17 '21 00:02 a3an-de

I tried with two versions on my PC with sleep and hibernate and could not reproduce it.

sys.version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
wx.__version__: 4.1.1

sys.version: 3.6.6 (default, Mar 21 2022, 14:08:33) [MSC v.1916 64 bit (AMD64)]
wx.__version__: 4.1.2a1

DietmarSchwertberger avatar Apr 06 '22 19:04 DietmarSchwertberger