wx.Grid and MakeCellVisible doesn't run

I've a problem under wx.Gtk using wx.Grid.MakeCellVisible.
it doesn't run.
I use Ubuntu 12.04 amd64, python 2.7.3 and wxPython 2.8.12.1 (gtk2-unicode)

This is a code example that doesn't run in the right way:

import wx
import wx.grid

class Test(wx.Frame):
  def __init__(self):
    wx.Frame.__init__(self, None, size=(640,480))
    grid = wx.grid.Grid(self)
    grid.CreateGrid(50, 50)
    grid.SetGridCursor(49, 0)
    grid.MakeCellVisible(49, 0)
    grid.SetFocus()
app = wx.App(False)
Test().Show()
app.MainLoop()

Can you help me please?
Thank you!

At the time that you call MakeCellVisible the grid is still its very small default size. If you delay the call until after the frame has been shown and it has resized the grid to fill its client area then it will work as you expect. For example:

import wx
import wx.grid

class Test(wx.Frame):
     def __init__(self):
         wx.Frame.__init__(self, None, size=(640,480))
         grid = wx.grid.Grid(self)
         grid.CreateGrid(50, 50)
         grid.SetGridCursor(49, 0)

         wx.CallAfter(grid.MakeCellVisible, 49, 0)

         grid.SetFocus()

app = wx.App(False)
Test().Show()
app.MainLoop()

···

On 6/1/12 12:15 AM, grappale wrote:

I've a problem under wx.Gtk using wx.Grid.MakeCellVisible.
it doesn't run.
I use Ubuntu 12.04 amd64, python 2.7.3 and wxPython 2.8.12.1 (gtk2-unicode)

This is a code example that doesn't run in the right way:

--
Robin Dunn
Software Craftsman

thank you!
But using a Virtual wxGrid, the code run well, also if return this error:

Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14665, in <lambda>
     lambda event: event.callable(*event.args, **event.kw) )
TypeError: 'NoneType' object is not callable

What'is it,please ?

···

Il 01/06/2012 19:29, Robin Dunn ha scritto:

wx.CallAfter(grid.MakeCellVisible, 49, 0)

Somewhere you are passing None to wx.CallAfter.

···

On 6/3/12 11:50 PM, grappale wrote:

Il 01/06/2012 19:29, Robin Dunn ha scritto:

wx.CallAfter(grid.MakeCellVisible, 49, 0)

thank you!
But using a Virtual wxGrid, the code run well, also if return this error:

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 14665, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
TypeError: 'NoneType' object is not callable

What'is it,please ?

--
Robin Dunn
Software Craftsman

I suspect you are passing "function_to_call()", rather than
"function_to_call" -- i.e. you want to pass the function itself,
rather than the result of calling it. (many functions return None --
that's why I suspect this is the cause of your error.

-Chris

···

On Mon, Jun 4, 2012 at 10:14 AM, Robin Dunn <robin@alldunn.com> wrote:

Somewhere you are passing None to wx.CallAfter.

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov