Issue Deleting Widgets in UltimateListCtrl

Hi, I'm new to wxPython, and I've been having an issue when I try to
DeleteAlllItems() from a ULC. I receive this error:
"wx._core.PyDeadObjectError: The C++ part of the Button object has
been deleted, attribute access no longer allowed." Is there a way to
fix this? I have been able to delete all the times if I use
DeleteItem() on every single item individually. Since this is slower
and I don't need the event, I would like to use DeleteAllItems() if
there is a way to get it to work.

I posted a question on StackOverFlow with the same code that applies:

http://stackoverflow.com/questions/3612934/placing-a-button-in-ultimatelistctrl-using-wxpython

Thanks,
Flow of Soul

In UltimateListCtrl.py (python26\Lib\site-packages\wx-2.8-msw-unicode
\wx\lib\agw) the function DoDeleteAllItems:

Replace:
        for item in self._itemWithWindow:
            wnd = item.GetWindow()
            wnd.Destroy()

with:
        for item in self._itemWithWindow:
                if item.GetWindow():
                    self.DeleteItemWindow(item)

And try it again, I'm guessing it will fix the problem. Backup the
file first before editing it! Then make a report in Trac setting
component AGW: http://trac.wxwidgets.org/ so someone can review it
more closely than I did.

Mark

···

On Sep 2, 5:40 am, Flow of Soul <flow.of.soul...@gmail.com> wrote:

Hi, I'm new to wxPython, and I've been having an issue when I try to
DeleteAlllItems() from a ULC. I receive this error:
"wx._core.PyDeadObjectError: The C++ part of the Button object has
been deleted, attribute access no longer allowed." Is there a way to
fix this? I have been able to delete all the times if I use
DeleteItem() on every single item individually. Since this is slower
and I don't need the event, I would like to use DeleteAllItems() if
there is a way to get it to work.

I posted a question on StackOverFlow with the same code that applies:

python - Placing a Button in UltimateListCtrl using wxPython - Stack Overflow

Thanks,
Flow of Soul

Hi Mark,

In UltimateListCtrl.py (python26\Lib\site-packages\wx-2.8-msw-unicode
\wx\lib\agw) the function DoDeleteAllItems:

Replace:
for item in self._itemWithWindow:
wnd = item.GetWindow()
wnd.Destroy()

with:
for item in self._itemWithWindow:
if item.GetWindow():
self.DeleteItemWindow(item)

And try it again, I'm guessing it will fix the problem. Backup the
file first before editing it! Then make a report in Trac setting
component AGW: http://trac.wxwidgets.org/ so someone can review it
more closely than I did.

Thank you for this, I'll try and update the SVN code when I get back
home. It would be nice to have a ticket for this, though.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
The Doomed City: Removal Group: the nightmare <==

···

On 2 September 2010 04:11, Mark wrote:

Thanks that piece of code, it works great. I'll try to figure out how
to submit a ticket for the issue.

···

On Sep 3, 8:58 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi Mark,

On 2 September 2010 04:11, Mark wrote:

> In UltimateListCtrl.py (python26\Lib\site-packages\wx-2.8-msw-unicode
> \wx\lib\agw) the function DoDeleteAllItems:

> Replace:
> for item in self._itemWithWindow:
> wnd = item.GetWindow()
> wnd.Destroy()

> with:
> for item in self._itemWithWindow:
> if item.GetWindow():
> self.DeleteItemWindow(item)

> And try it again, I'm guessing it will fix the problem. Backup the
> file first before editing it! Then make a report in Trac setting
> component AGW:wxTrac has been migrated to GitHub Issues - wxWidgets someone can review it
> more closely than I did.

Thank you for this, I'll try and update the SVN code when I get back
home. It would be nice to have a ticket for this, though.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.http://thedoomedcity.blogspot.com/2010/03/removal-group-nightmare.html&lt;==

Hi All,

Thanks that piece of code, it works great. I'll try to figure out how
to submit a ticket for the issue.

Hi Mark,

> In UltimateListCtrl.py (python26\Lib\site-packages\wx-2.8-msw-unicode
> \wx\lib\agw) the function DoDeleteAllItems:

> Replace:
> for item in self._itemWithWindow:
> wnd = item.GetWindow()
> wnd.Destroy()

> with:
> for item in self._itemWithWindow:
> if item.GetWindow():
> self.DeleteItemWindow(item)

> And try it again, I'm guessing it will fix the problem. Backup the
> file first before editing it! Then make a report in Trac setting
> component AGW:wxTrac has been migrated to GitHub Issues - wxWidgets someone can review it
> more closely than I did.

Thank you for this, I'll try and update the SVN code when I get back
home. It would be nice to have a ticket for this, though.

This should now be fixed in SVN revision 65529.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
The Doomed City: Removal Group: the nightmare <==

···

On 4 September 2010 02:44, Flow of Soul wrote:

On Sep 3, 8:58 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:

On 2 September 2010 04:11, Mark wrote: