[wxPython] PROBLEM WITH wxListCtrl

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

[wxPython] PROBLEM WITH wxListCtrl

Cristian Echeverria-2

I have wxPython 2.1b2, win95, python 1.5.2.
Weeks ago I asked for a problem with wxListCtrl
(a performace problem with a 10 columns,7000 rows table)

Robin Dunn wrote:
>> A change has just been made to the wxWindows library that will hopefully fix
>> this.  The delete item event has been disabled durring the DeleteAllItems
>> method.  I'm getting ready to try it out.

Ok, I tested my app whith the new version and the problem still be there
- When I destroy the main window it takes about a minute to desapear.
- DeleteAllItems is a bit faster than the previous version, but still is very slow.
- Insert items take to much time too.

Questions?
- Are there a way to insert many items without refreshing the view ?.
- I am not a good C++ programmer, but I think there is a problem at the
  C++ level when you destroy a widget whit many data. Some people
  has said that this is a problem in wxWindows.
- This is very strange, becouse the same table with 1000 rows has very
  good performace, but when you have more than 2000 performance go down.

To confirm the problem I made a simple Table widget on Tkinter with pure python
code, using Tkinter Listbox. This works right with the 7000 rows and the widgets
destroy and refresh very fast.

Database applications are very important today.
I like wxPython, but I think this problem is important for the succes of wxPython.
I want help, just tellme how...

Cristian Echeverria.


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] PROBLEM WITH wxListCtrl

Robin Dunn
>
> I have wxPython 2.1b2, win95, python 1.5.2.
> Weeks ago I asked for a problem with wxListCtrl
> (a performace problem with a 10 columns,7000 rows table)
>
> Robin Dunn wrote:
> >> A change has just been made to the wxWindows library that will
hopefully fix
> >> this.  The delete item event has been disabled durring the
DeleteAllItems
> >> method.  I'm getting ready to try it out.
>
> Ok, I tested my app whith the new version and the problem still be there
> - When I destroy the main window it takes about a minute to desapear.
> - DeleteAllItems is a bit faster than the previous version, but still is
very slow.
> - Insert items take to much time too.

I just changed the ListCtrl demo to have 10 columns and 10000 lines.  It
takes some time (only about 20 seconds) to generate the data, but this is
just due to the volume of method calls that have to be made in the for loop.
Not much that can be done about that.

The DeleteAllItems (right click on the list and select from the popup menu)
is instantaneous, and closing the main window is just as fast as normal too.
I am running on NT 4.0 on a 300MHz Pentium II.  It's a fast machine, but no
spead deamon.

Could there be something else in your app that is causing the slowdown?
Have you tried isolating the problem by removing non GUI things?  If you can
demonstrate the problem with only wxPython and send me the source I will be
better able to help.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!







_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] PROBLEM WITH wxListCtrl

Cristian Echeverria-2
In reply to this post by Cristian Echeverria-2
Ok...
I have a Pentium 233 Mhz, running win95

I changed the ListCrtl demo, only the __init__ method, in that way:

class TestListCtrlPanel(wxPanel):
    def __init__(self, parent, log):
        wxPanel.__init__(self, parent, -1)

        self.log = log
        tID = NewId()

        self.il = wxImageList(16, 16)
        idx1 = self.il.Add(wxNoRefBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))

        self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
                               wxLC_REPORT|wxSUNKEN_BORDER)
        self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)

        self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
        wxToolTip_Enable(true)

        #-------------------------------------------------------------------------------------
        # CRISTIAN ECHEVERRIA CHANGED THIS
        #self.list.InsertColumn(0, "Column 0")
        #self.list.InsertColumn(1, "Column 1")
        #self.list.InsertColumn(2, "One More Column (2)")
        for i in range(10):
            texto = "Columna %d" % i
            self.list.InsertColumn(i,texto)
        for x in range(7050):
            self.list.InsertImageStringItem(x, "This is item %d" % x, idx1)
            for i in range(1,10):
                texto = "Col %d, item %d" % (i,x)
                self.list.SetStringItem(x,i,texto)
            #self.list.SetStringItem(x, 1, "Col 1, item %d" % x)
            #self.list.SetStringItem(x, 2, "item %d in column 2" % x)
        # END CRISTIAN ECHEVERRIA CHANGED THIS
        #-------------------------------------------------------------------------------------

        self.list.SetColumnWidth(0, wxLIST_AUTOSIZE)
        self.list.SetColumnWidth(1, wxLIST_AUTOSIZE)
        self.list.SetColumnWidth(2, wxLIST_AUTOSIZE)

        self.list.SetItemState(5, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)

        self.currentItem = 0
        EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
        EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
        EVT_LEFT_DCLICK(self.list, self.OnDoubleClick)
        EVT_RIGHT_DOWN(self.list, self.OnRightDown)

        # for wxMSW
        EVT_COMMAND_RIGHT_CLICK(self.list, tID, self.OnRightClick)

        # for wxGTK
        EVT_RIGHT_UP(self.list, self.OnRightClick)
#------------------------------------------------------------------------------------------

...then I measure the time :

1.- Click on the wxListCtrl tree item: takes 20 seconds and the ListCtrl appears.
2.- then Click on the wxTextCtrl tree item : takes 20 seconds and the TextCtrl demo appears.
3. then Click on wxListCtrl tree item again : takes 20 seconds and the ListCtrl appears.
4.- then DeleteAllItems (right click on the list and select from the popup menu): takes
     50 seconds and all items desapear.
5. If I close the wxPython demo after deleting all the items, it quits very fast, but if I close
    the demo with all the items inside the ListCtrl it takes 45 seconds to exit.

I agree with you that inserting the items takes a normal time (it took me the same time than you)
but I think there is a problem with DeleteAllItems, and I think the Destroy method is calling
DeleteAllItems in some way.


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] PROBLEM WITH wxListCtrl

Robin Dunn
> [sample code snipped]

Okay, your changes to the ListCtrl demo are nearly the same as what I tried.
The only difference left I think is the actual version of the MSW List
Control.  Since you are on win95 and I am on NT 4 with all the latest
service packs and such, it is very likely that I have a newer version of the
list control than you.  I am guessing that this control lives in
COMCTL32.DLL in the system or system32 directory.  Mine has a File Version
of 5.80 and a Product Version of 5.00.2314.1000.  What is yours?

It could be that an older version of the control does not recognise the flag
used to disable the delete item event and the update view event durring the
DeleteAllItems method.

If I remember right, installing IE 4 or 5 should update this dll to a newer
version than what came with win95.


>
> I agree with you that inserting the items takes a normal time (it took me
the same time than you)
> but I think there is a problem with DeleteAllItems, and I think the
Destroy method is calling
> DeleteAllItems in some way.

Yes, the C++ destructor for the wxListCtrl calls DeleteAllItems.

Robin


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

RE: [wxPython] PROBLEM WITH wxListCtrl

Cristian Echeverria-2
In reply to this post by Cristian Echeverria-2
Ok...
I have COMCTL32.DLL version 4.7, product version 4.7.
I am going to see a way to update it.

Is realy necesary that the destructor call to DeleteAllItems?

Thanks
CRISTIAN ECHEVERR√ćA

-----Mensaje original-----
De: Robin Dunn [SMTP:[hidden email]]
Enviado el: Lunes 9 de Agosto de 1999 03:37 PM
Para: Cristian Echeverria
CC: '[hidden email]'
Asunto: Re: [wxPython] PROBLEM WITH wxListCtrl

> [sample code snipped]

Okay, your changes to the ListCtrl demo are nearly the same as what I tried.
The only difference left I think is the actual version of the MSW List
Control.  Since you are on win95 and I am on NT 4 with all the latest
service packs and such, it is very likely that I have a newer version of the
list control than you.  I am guessing that this control lives in
COMCTL32.DLL in the system or system32 directory.  Mine has a File Version
of 5.80 and a Product Version of 5.00.2314.1000.  What is yours?

It could be that an older version of the control does not recognise the flag
used to disable the delete item event and the update view event durring the
DeleteAllItems method.

If I remember right, installing IE 4 or 5 should update this dll to a newer
version than what came with win95.


>
> I agree with you that inserting the items takes a normal time (it took me
the same time than you)
> but I think there is a problem with DeleteAllItems, and I think the
Destroy method is calling
> DeleteAllItems in some way.

Yes, the C++ destructor for the wxListCtrl calls DeleteAllItems.

Robin


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] PROBLEM WITH wxListCtrl

Robin Dunn
> Ok...
> I have COMCTL32.DLL version 4.7, product version 4.7.
> I am going to see a way to update it.
>
> Is realy necesary that the destructor call to DeleteAllItems?

Yes, otherwise there would be memory leaked for each item.

Robin




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users