[wxPython-users] Re: PyGridTableBase: database update + errata

Frank Millman frank at chagford.com
Mon Jul 30 00:04:17 PDT 2007


Dominique wrote:
> 
> In the previous code, the list of data was not updated. But 
> even after correction, it still doesn't work.
> 
> I simplified everything with the new code that follows:
> Additionally, 2 questions:
> - when do we have to call SetValue and How ?
> - it seems GetValue() is called twice (see the print): why ?
> 
> Thanks for your help
> Dominique
> 

I don't know what your original question was - what 'doesn't work'?

Regarding your other two questions -

1. If the user modifies the contents of a cell, wxPython calls
SetValue(row,col,value) to notify you. It is up to you to over-ride this
method, and update your underlying data with the new value as appropriate.

Instead of
    def SetValue(self, row, col, value):
        pass
try
    def SetValue(self, row, col, value):
        print 'SetValue',row,col,value

You will see that it is called whenever you change a value.

2. I find that GetValue() is called many times, depending on platform,
circumstances, etc. Don't worry about it - so long as you return the correct
value, wxPython will ensure that the grid is displayed correctly.

HTH

Frank Millman





More information about the wxpython-users mailing list