[wxPython-users] A couple of questions...

Jerry LeVan levanj at mac.com
Fri Apr 27 10:42:53 PDT 2007


On Apr 27, 2007, at 12:58 PM, Robin Dunn wrote:

> Jerry LeVan wrote:
>> On Apr 26, 2007, at 2:51 PM, Robin Dunn wrote:
>>> Jerry LeVan wrote:
>>>> Hi,
>>>> I recently picked up wxPython In Action and installed
>>>> 1) Python 2.5.1 and wxPython 2.8.3 on my mac osx 10.4.9 system
>>>> 2) Python 2.4.4 and wxPython 2.6.3 on my linux fc6 machine.
>>>> In running through some examples from the source code in the wIA  
>>>> book
>>>> I found that the Grid examples in Chapter 14 did not work properly.
>>>> In particular, when scrolling the grid ( grid_table.py in  
>>>> chapter 14)
>>>> using the scrollbars I found that the row and column headers did  
>>>> not
>>>> scroll with the table!
>>>> I found that if I forced an update by resizing the window header  
>>>> would
>>>> be redrawn properly... It appears that the row/column headers  
>>>> are not
>>>> being properly updated when the scrollbars are used.
>>>> Using the "arrow" keys does cause the row/column heads to be  
>>>> properly
>>>> updated.
>>>> The examples *did* work on my linux box.
>>>> Is this a known problem?
>>>
>>> Yes.  I thought it was fixed already, but I see that it is still  
>>> happening in my local workspace.  I'll look into it again.
>>>
>>> BTW, you can workaround this in the meantime by forcing a cell  
>>> editor to be created, because once the grid has a child window  
>>> then the optimization that causes this problem is not used.   
>>> Something like this:
>>>
>>>     grid.EnableCellEditControl()
>>>     grid.DisableCellEditControl()
>>>
>> I don't seem to be able to create the editor ( probably because it
>> is all new to me).
>> I *can* click in a cell and then scrolling works properly. I tried  
>> this
>> but I don't get the cell editor ;(
>
> It will work if you delay the hack until later, after the grid has  
> had a chance to paint itself and finish configuring itself.   
> wxPython provides the wx.CallAfter function to help with things  
> like this, it allows you to have a function called when the app is  
> next idle:
>
> class TestFrame(wx.Frame):
>     def __init__(self):
>         wx.Frame.__init__(self, None, title="Grid Table",
>                           size=(640,480))
>
>         grid = wx.grid.Grid(self)
>
>         table = TestTable()
>         grid.SetTable(table, True)
>
>         wx.CallAfter(self.WorkaroundScrollBug, grid)
>
>     def WorkaroundScrollBug(self, grid):
>         grid.EnableCellEditControl()
>         grid.DisableCellEditControl()
>
>
> -- 
> Robin Dunn

Thank you!

Will 2.8.4 contain a proper fix :)

Jerry




More information about the wxpython-users mailing list