I would like to create a grid with Boa, but I dont know where to set the number of rows and columns.

There are a few things the frame builder does not do, you have to do those in the Boa editor yourself. Here is an example:

#Boa:Frame:Frame1

import wx
import wx.grid

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1GRID1, 
] = [wx.NewId() for _init_ctrls in range(2)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(366, 256), size=wx.Size(400, 250),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(384, 214))

        self.grid1 = wx.grid.Grid(id=wxID_FRAME1GRID1, name='grid1',
              parent=self, pos=wx.Point(8, 8), size=wx.Size(368, 200), style=0)
        self.grid1.Center(wx.VERTICAL)

        # you have to add this in the editor!!!
        # grid has 8 rows and 5 columns
        self.grid1.CreateGrid(8, 5)

        # you can als add some simple cell formatting
        self.grid1.SetColSize(3, 200)
        self.grid1.SetRowSize(0, 25)
        self.grid1.SetCellValue(0, 0, "First cell")
        self.grid1.SetCellValue(1, 1, "Another cell")
        self.grid1.SetCellValue(2, 2, "Yet another cell")
        self.grid1.SetCellValue(3, 3, "This cell is read-only")
        self.grid1.SetCellFont(0, 0, wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL))
        self.grid1.SetCellTextColour(1, 1, wx.RED)
        self.grid1.SetCellBackgroundColour(2, 2, wx.CYAN)
        self.grid1.SetReadOnly(3, 3, True)
        
        

    def __init__(self, parent):
        self._init_ctrls(parent)


if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = create(None)
    frame.Show()

    app.MainLoop()

Actually Snee made mistake in his code. Do not write your additional code in the __init__ctrls() method, boa tells you not to edit this part. If you do, the Frame Designer frowns on it, if you want to use it later to add additional widgets. So in the frame designer Evts tab pick FrameEvent and then wx.EVT_ACTIVATE to create the OnFrame1Activate() method. This is where your additional code goes. Here is the modified code:

#Boa:Frame:Frame1

import wx
import wx.grid

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1GRID1, 
] = [wx.NewId() for _init_ctrls in range(2)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(366, 256), size=wx.Size(400, 250),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(384, 214))
        self.Bind(wx.EVT_ACTIVATE, self.OnFrame1Activate)

        self.grid1 = wx.grid.Grid(id=wxID_FRAME1GRID1, name='grid1',
              parent=self, pos=wx.Point(0, 0), size=wx.Size(384, 214), style=0)
        self.grid1.Center(wx.VERTICAL)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnFrame1Activate(self, event):
        # under events pick FrameEvent and then wx.EVT_ACTIVATE
        # now you can add your own code here and still have the use
        # of BOA's Frame Designer
        #
        # give grid 8 rows and 5 columns
        self.grid1.CreateGrid(8, 5)

        # you can als add some simple cell formatting
        self.grid1.SetColSize(3, 200)
        self.grid1.SetRowSize(0, 25)
        self.grid1.SetCellValue(0, 0, "First cell")
        self.grid1.SetCellValue(1, 1, "Another cell")
        self.grid1.SetCellValue(2, 2, "Yet another cell")
        self.grid1.SetCellValue(3, 3, "This cell is read-only")
        self.grid1.SetCellFont(0, 0, wx.Font(12, wx.ROMAN, wx.ITALIC, wx.NORMAL))
        self.grid1.SetCellTextColour(1, 1, wx.RED)
        self.grid1.SetCellBackgroundColour(2, 2, wx.CYAN)
        self.grid1.SetReadOnly(3, 3, True)


if __name__ == '__main__':
    # use 'Add module runner' in the Edit menu
    # this gives you single source file code
    app = wx.PySimpleApp()
    frame = create(None)
    frame.Show()

    app.MainLoop()
This article has been dead for over six months. Start a new discussion instead.