can't see a grid in a notebook with a button?

hi,

i'm having troubles adding a grid and a button to a notebook page.
please help. the code below is what i think should work, but i only
see the button and no grid in the notebook page.

thanks in advance,

jack

from wxPython.wx import *
from wxPython.grid import *

class tf(wxFrame):
def __init__(self, parent, id, title):
  wxFrame.__init__(self, parent, -1, title)
  nb=wxNotebook(self,-1)
  nbs=wxNotebookSizer(nb)
  pan=wxPanel(nb,-1)
  panszr=wxBoxSizer(wxHORIZONTAL)
  grid=wxGrid(pan,-1)
  grid.CreateGrid(2,2)
  for i in range(0,4):
   grid.SetCellValue(i/2,i%2,`i`)
  panszr.Add(grid)
  panszr.Add(wxButton(pan,-1,'me'))
  pan.SetAutoLayout(1)
  pan.SetSizer(panszr)
  nb.AddPage(pan,"grid'n'button")
  self.Show(true)

class MyApp(wxApp):
def OnInit(self):
  fr=tf(None, -1, "")
  fr.Show()
  return true

app = MyApp(0)
app.MainLoop()

You could try setting sizes for your controls or at least you frame or
change this line for...

  panszr.Add(grid, 1, wxEXPAND)

the 1 is a proportional factor on how the controls gets expanded
compared to the other controls in the sizer that also use exEXPAND

Raul

From: Jack Andrews [mailto:JAndrews@str.com.au]
Sent: Wednesday, February 05, 2003 8:17 PM
To: 'wxpython-users@lists.wxwindows.org'
Subject: [wxPython-users] can't see a grid in a notebook with a

button?

hi,

i'm having troubles adding a grid and a button to a notebook page.
please help. the code below is what i think should work, but i only
see the button and no grid in the notebook page.

thanks in advance,

jack

from wxPython.wx import *
from wxPython.grid import *

class tf(wxFrame):
def __init__(self, parent, id, title):
  wxFrame.__init__(self, parent, -1, title)
  nb=wxNotebook(self,-1)
  nbs=wxNotebookSizer(nb)
  pan=wxPanel(nb,-1)
  panszr=wxBoxSizer(wxHORIZONTAL)
  grid=wxGrid(pan,-1)
  grid.CreateGrid(2,2)
  for i in range(0,4):
   grid.SetCellValue(i/2,i%2,`i`)
  panszr.Add(grid)
  panszr.Add(wxButton(pan,-1,'me'))
  pan.SetAutoLayout(1)
  pan.SetSizer(panszr)
  nb.AddPage(pan,"grid'n'button")
  self.Show(true)

class MyApp(wxApp):
def OnInit(self):
  fr=tf(None, -1, "")
  fr.Show()
  return true

app = MyApp(0)
app.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:

wxPython-users-help@lists.wxwindows.org

···

-----Original Message-----