AUI Child Frame close with

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

AUI Child Frame close with

zylyco

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.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

test.py (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: AUI Child Frame close with

Robin Dunn
On Wednesday, May 2, 2018 at 5:25:17 AM UTC-7, Zylyco wrote:

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 ?



Yes, it looks like it's a bug in wxWidgets. I'll poke around later to see if I can find an easy workaround for you or implement a fix.

BTW, it doesn't avoid this problem, but probably a better way to close all MDI child frames would be a loop like this, since it doesn't require knowledge of the implementation and hierarchy of the windows:

        child = self.GetActiveChild()
        while child:
            child.Close()
            child = self.GetActiveChild()


--
Robin



--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: AUI Child Frame close with " wxStaticCast() used incorrectly "

zylyco

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.



Le 02/05/2018 à 22:24, Robin Dunn a écrit :

Yes, it looks like it's a bug in wxWidgets. I'll poke around later to see if I can find an easy workaround for you or implement a fix.

BTW, it doesn't avoid this problem, but probably a better way to close all MDI child frames would be a loop like this, since it doesn't require knowledge of the implementation and hierarchy of the windows:

        child = self.GetActiveChild()
        while child:
            child.Close()
            child = self.GetActiveChild()


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: AUI Child Frame close with " wxStaticCast() used incorrectly "

zylyco

Since I upgraded to wxPython-4.0.2a1.dev3763 :
All is fine now...

Thank you Robin

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.