2 panels in a NotebookPage

Matthieu Brucher matthieu.brucher at gmail.com
Tue Oct 23 14:18:03 PDT 2007


Hi,

I'm trying to get two simple panels with somecheckboxes appear on a classic
NotebookPage. The problem is that they do not display themselves correctly :

#!/usr/bin/env python

import wx

class MyPage(wx.NotebookPage):
  def __init__(self, parent):
    wx.NotebookPage.__init__(self, parent, -1)
    sizer =3D wx.BoxSizer(wx.VERTICAL)

    sizer.Add(self.createBoxes(), 0, 0)
    sizer.Add(self.createBoxes(), 0, 0)

    self.SetSizer(sizer)
    self.Fit()

  def createBoxes(self):
    """
    Create a set of checkboxes. Here a specific sizer is used
    """
    panel =3D wx.Panel(self)
    sizer =3D wx.GridSizer(4, 7)
    for x in range(0, 4):
      for y in range(0, 7):
        box =3D wx.CheckBox(panel, -1, '%d-%d' %(x, y))
        sizer.Add(box)
    panel.SetSizer(sizer)
    panel.Fit()
    return panel

class MainFrame(wx.Frame):
  def __init__(self):
    wx.Frame.__init__(self, None, -1)
    self.notebook =3D wx.Notebook(self)
    self.notebook.AddPage(MyPage(self.notebook), "test")

class App(wx.App):
  def OnInit(self):
    'Create the main window and insert the custom frame'
    frame =3D MainFrame()
    frame.Show(True)

    return True

app =3D App(0)
app.MainLoop()

With this sample, two panels are created with createBoxes(), but only one is
displayed and usable.
Is there an obvious mistake in what I'm doing ?

Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200710=
23/215d625c/attachment.htm


More information about the wxpython-users mailing list