Hi all,
I use wxPython 4.0.2a1.dev3717+d4bd2fe, with Python 3.5.3, on a Linux system.
(The problem doesn't show up on Windows with wxPython 4.0.1 and
Python 3.6.5)
I noticed the message :
wx._core.wxAssertionError: C++ assertion "wxDynamicCast(ptr, T)" failed at /tmp/pip-build-5abqkim7/wxPython/ext/wxWidgets/include/wx/object.h(160) in wxCheckCast(): wxStaticCast() used incorrectly
Please try the attached code : open 3 ChildFrames for example (or more), then stay "active" on the last child opened, and use " File / Close Parent " :
you should get that message in console.
I tried the same with Python 2.7.13 : same message occurs.
It's not really an error message, but it's disturbing.
What do you think about it ?
Can it be called a bug ?
Or is it caused by my bad code ?
Thanks.
Thank you Robin.
I changed the code to :
def OnCloseWindow(self, evt):
child = self.GetActiveChild()
while child:
child.Close()
child = self.GetActiveChild()
evt.Skip()
But the result is almost the same :
$ python3 test.py
Traceback (most recent call last):
File "test.py", line 50, in OnCloseWindow
child.Close()
wx._core.wxAssertionError: C++ assertion "wxDynamicCast(ptr, T)" failed at /tmp/pip-build-5abqkim7/wxPython/ext/wxWidgets/include/wx/object.h(160) in wxCheckCast(): wxStaticCast() used incorrectly
$
I hope you'll find a way to fix that behavior in next release...
Note :
I obtained that my real project code can works, but that alert
message (still present) caused I had to struggled with it for a
while, ignoring if this alert was belonging to ... my python's
code or a bug ? Now my mind is clear.