On Mon, Oct 13, 2003 at 08:57:09AM -0500, Dave wrote:
> Still having problems with this one.. I will include a URL to see what's
> happening.. I have changed my subclass to this:
As it happens, I *just* dealt with this problem. Do the
following to properly size the wxNotebook:
-------------------------------------------
import wx
...
self.sizer = wx.BoxSizer(wx.VERTICAL)
...
self.nb = wx.Notebook(self, -1)
self.nbs = wx.NotebookSizer(self.nb)
self.sizer.Add(self.nbs, 0, wx.ALIGN_LEFT)
...
self.sizer.Layout()
-------------------------------------------
As far as I can tell, what is happening is that a notebook
attached to a frame directly is automatically sized and
doesn't need wx.NotebookSizer. Anywhere else (a sub-panel,
a notebook within a notebook, etc.) and it needs the
wx.NotebookSizer to be used as shown above. If you don't
have a sizer you're adding components to for some reason,
you can call Layout() directly on the wx.NotebookSizer
object. You could just always talk to wx.NotebookSizer, but
I at least tend to size the original sizer for the object,
then let it deal with its children as needed.
/begin rant
If you ask me the wx.Notebook class should have a function
to set its size to its contents either automatically when in a
generic sizer or on demand.....as you found, the above
creates the same issue being seen by person after person,
when you should be able to just call "self.nb.AutoLayout()"
or something.
/end rant 
Hope this helps.
--David
> from wxPython.wx import *
>
> class infoPane(wxPanel):
> def __init__(self, parent, data):
> wxPanel.__init__(self, parent, -1)
>
> self.parent = parent
> self.data = data
>
> bs = wxBoxSizer(wxVERTICAL)
>
> nID = wxNewId()
> self.nb = wxNotebook(self, nID, style=wxNB_RIGHT)
>
> win = wxTextCtrl(self.nb, 8505, value=self.data,
> style=wxTE_READONLY|wxTE_MULTILINE)
>
> self.nb.AddPage(win, "Test Data", TRUE)
>
> bs.Add(self.nb, 1, wxEXPAND|wxALL, 10)
> self.SetSizerAndFit(bs)
>
> here is the pic:
> http://dave.voygr.com/lists/wxNotebook.jpg
>
> Thanks guys..
>
> At 07:36 PM 10/10/03, you wrote:
> **snip**
> >class infoPane(wxPanel):
> > def __init__(self, parent, data):
> > wxPanel.__init__(self, parent, -1)
> >
> > self.parent = parent
> >
> > bs = wxBoxSizer(wxVERTICAL)
> >
> > nID = wxNewId()
> > self.nb = wxNotebook(self, nID, style=wxNB_RIGHT)
> >
> > win = wxTextCtrl(self.nb, 8505, value=data,
> >style=wxTE_READONLY|wxTE_MULTILINE)
> > self.nb.AddPage(win, "Test Data", TRUE)
> >
> > bs.Add(self.nb, 1, wxEXPAND|wxALL, 10)
> > self.SetSizerAndFit(bs)
> >
> >app = wxPySimpleApp()
> >frame = wxFrame(None, -1, "sldfkjsldkf")
> >ip = infoPane(frame, "Hello")
> >frame.Show()
> >app.MainLoop()
> >
> >--
> >Robin Dunn
> >Software Craftsman
> >http://wxPython.org Java give you jitters? Relax with wxPython!
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> >For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org