too much widgets?

Hi there!

I've a notebook with some hundred buttons in a GridBagSizer on one page, that needs to get updated sometimes.
After the third (or so) update, I get an exception for every new widget:

C++ assertion "wxAssertFailure" failed in ..\..\src\msw\control.cpp(162): CreateWindowEx("BUTTON", flags=56010000, ex=00000000) failed

If I handle the button creation in a try...except, I get the lethal exception at the next "unbuffered" widget creation, so I guess there are simply too much widgets.
I thought that wouldn't happen if I destroy all children of the notebook page, and so I call DestroyChildren() before every update and create the whole thing (Sizer + Buttons etc.) from scratch. But that doesn't seem to help.

What can I do?

(This is WinXP, Py 2.3, wxPy 2.6.)

Best regards,
Henning Hraban Ramm
Südkurier Medienhaus / MediaPro
Support/Admin/Development Dept.

Hi Henning,

Hi there!

I've a notebook with some hundred buttons in a GridBagSizer on one page, that needs to get updated sometimes.
After the third (or so) update, I get an exception for every new widget:

C++ assertion "wxAssertFailure" failed in ..\..\src\msw\control.cpp(162): CreateWindowEx("BUTTON", flags=56010000, ex=00000000) failed

I had some "resource" problem on Win98 and WinME, both these systems don't return unused resources unless the program gets minimized or a dialog is shown. I asked about this a few weeks ago (search for subject "PyAssertionError" and worked around the problem by doing the following:

    def MyGcCollect(self, message='', done=0, max=0):
        x = gc.collect()
        if self.winPlatform in ['98', 'Me']:
            if done == 1:
                self.dlgPro = wx.ProgressDialog(_('Windows 9x - forcing release of resources'),
                           message,
                           max,
                           self,
                           wx.PD_AUTO_HIDE | wx.PD_APP_MODAL)
            self.dlgPro.Update(done, message)

If I handle the button creation in a try...except, I get the lethal exception at the next "unbuffered" widget creation, so I guess there are simply too much widgets.
I thought that wouldn't happen if I destroy all children of the notebook page, and so I call DestroyChildren() before every update and create the whole thing (Sizer + Buttons etc.) from scratch. But that doesn't seem to help.

What can I do?

But a 100 or more buttons on a single screen (or do you mean in all the notebook pages?) sounds like a lot, maybe you should also review and/or look for other solutions to try to get the number of widgets on a single panel down.

See you
Werner

···

Henning.Ramm@mediapro-gmbh.de wrote:

(This is WinXP, Py 2.3, wxPy 2.6.)

Best regards,
Henning Hraban Ramm
Südkurier Medienhaus / MediaPro
Support/Admin/Development Dept.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org