Re: wxNotebook and DeleteAllPages()

PyMapper Developer <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
I'm in the same thread, and not calling from EVT_PAINT.  I tried 
wx.CallAfter, but it returned the same errors.

On Tuesday, April 25, 2017 at 8:45:24 PM UTC-6, Robin Dunn wrote:
>
> PyMapper Developer wrote:
>
> Hello all, 
>     I'm updating older code that was running on python 2.7 and wxpython 
> 2.8.12 to now run on python 3.6 and wxPhoenix.  I have run into the 
> following error messages:
>
> <class 'wx._core.PaintEvent'> returned a result with an error set
>
> wx._core.wxAssertionError: C++ assertion "(int)m_pages.Count() == 
> (int)::SendMessageW((((HWND)GetHWND())), (0x1300 + 4), 0, 0L)" failed at 
> ..\..\src\msw\notebook.cpp(343) in wxNotebook::GetPageCount():
>
> This occurs when I have an active wxNotebook (with any number of pages) 
> where I try to create a new page, after having called the DeleteAllPages() 
> method.  Did the behavior of wxNotebook change somewhere between 2.8.12 and 
> 4.0, or is this a bug in the wxNotebook?
>
>
> It's hard to say for sure but it's possible that there are some internal 
> values (in wx or the native libs) that are in an inconsistent state 
> immediately after a DeleteAllPages and the notebook isn't ready for new 
> pages again until it has cleaned those up. If that's the case then it may 
> help to not add any new pages until after the pending events have been 
> processed. Using wx.CallAfter can help you with that.
>
> The fact that the error is detected while the in the wx.PainEvent code is 
> a red flag for me too... It is possible that the context that you are 
> calling DeleteAllPages in that is the trouble. Do you call it from the 
> EVT_PAINT handler? From another thread?
>
> -- 
> Robin Dunn
> Software Craftsman 
> http://wxPython.org
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.