[wxPython] problem with wxBoxSizer and wxNotebook

Sorry, I received the mail with a wrong mail client, so
I had to break the thread.

Code example again:

#!/usr/bin/env python

from wxPython.wx import *

class app(wxApp):
    def OnInit(self):
        f=wxFrame(None, -1, 'hallo', wxDefaultPosition)
        mainsizer=wxBoxSizer(wxVERTICAL)
        f.SetAutoLayout(true)
        f.SetSizer(mainsizer)

        mainsizer.Add(wxStaticText(f, -1, "hello text"), 1, wxEXPAND)
        mainsizer.Add(wxStaticText(f, -1, "another text"), 1, wxEXPAND)

        notebook = wxNotebook(f, -1)
        notesizer = wxNotebookSizer(notebook)
        mainsizer.Add(notesizer, 1, wxEXPAND)

        page = wxPanel(notebook, -1)
        pagesizer=wxBoxSizer(wxVERTICAL)
        page.SetAutoLayout(true)
        page.SetSizer(pagesizer)

        notebook.AddPage(page, "Hallo")

        pagesizer.Add(wxStaticText(page, -1, "text on page"))
        pagesizer.Add(wxStaticText(page, -1, "some more text on page"))

        mainsizer.Fit(f)

        f.Show(true)
        self.SetTopWindow(f)

        return true

a=app()
a.MainLoop()

What I get is:

···

+-----------------+

hello text |
                >
another text |
                >
-------+ |
Hallo |_________|

------------------+

As I must not add the pagesizer to the notesizer I
added it then to the mainsizer. ( mainsizer.Add(pagesizer) )

What I get now is:
+-----------------+

hello text |
                >
another text |
                >
-------+ |
Hallo |_________|
-----------------|
                >
                >

+-----------------+

The notebook page is too short and I can't see any text on it.
When sizing the frame bigger I can see the text in both
examples (with and without adding the pagesizer) but
the sizing does not seem work be correct.

Thanks for your help.

cu
Michael

Code example again:

#!/usr/bin/env python

from wxPython.wx import *

class app(wxApp):
    def OnInit(self):
        f=wxFrame(None, -1, 'hallo', wxDefaultPosition)
        mainsizer=wxBoxSizer(wxVERTICAL)
        f.SetAutoLayout(true)
        f.SetSizer(mainsizer)

        mainsizer.Add(wxStaticText(f, -1, "hello text"), 1, wxEXPAND)
        mainsizer.Add(wxStaticText(f, -1, "another text"), 1, wxEXPAND)

        notebook = wxNotebook(f, -1)
        notesizer = wxNotebookSizer(notebook)
        mainsizer.Add(notesizer, 1, wxEXPAND)

        page = wxPanel(notebook, -1)
        pagesizer=wxBoxSizer(wxVERTICAL)
        page.SetAutoLayout(true)
        page.SetSizer(pagesizer)

        notebook.AddPage(page, "Hallo")

        pagesizer.Add(wxStaticText(page, -1, "text on page"))
        pagesizer.Add(wxStaticText(page, -1, "some more text on page"))

        mainsizer.Fit(f)

        f.Show(true)
        self.SetTopWindow(f)

        return true

a=app()
a.MainLoop()

What I get is:
+-----------------+
> hello text |
> >
> another text |
> >
>-------+ |
> Hallo |_________|
------------------+

I get this:

···

+-----------------------+
> hello text |
> >
> >
> >
> another text |
> >
> >
> >
>-------+ |
> Hallo |_______________|
> >
>text on page |
>some more text on page |
------------------------+

What platform are you on and what are the versions of everything?

As I must not add the pagesizer to the notesizer I
added it then to the mainsizer. ( mainsizer.Add(pagesizer) )

What I get now is:
+-----------------+
> hello text |
> >
> another text |
> >
>-------+ |
> Hallo |_________|
>-----------------|
> >
> >
+-----------------+

By adding it to the mainsizer you are telling it to allocate that much space
at the top level after the notebook, which is not what you want. As I've
shown above, your code is supposed to be correct, and is in my current
version.

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

What platform are you on and what are the versions of everything?

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
stepping : 3
cpu MHz : 701.598
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips : 1399.19

···

--------

Linux version 2.4.16-686 (herbert@gondolin) (gcc version 2.95.4 20011006 (Debian prerelease)) #1 Wed Nov 28 09:27:17 EST 2001

libc6 2.2.4-7

Python 2.1.1+ (#1, Dec 30 2001, 17:17:30)
[GCC 2.95.4 20011223 (Debian prerelease)] on linux2

libwxgtk-python 2.2.7

--------

ok... now compiled wxGTK (2.3.2) and wxPython(2.3.1) from source.
Now everything seems to work fine. The main window is a bit too high
but too high is better than too small :wink:

Thanks for your great help.

cu
Michael

Hi,

wxStyledTextCtrl looks like a highly useful component/widget, but I haven't
been able to find any documentation for it. Does this exist, or is it planned
for inclusion in a future release?

TIA,

libwxgtk-python 2.2.7

Okay, that does make a difference. For some reason I thought you were
talking about 2.3.x.

ok... now compiled wxGTK (2.3.2) and wxPython(2.3.1) from source.
Now everything seems to work fine. The main window is a bit too high
but too high is better than too small :wink:

Any reason why you are not using 2.3.2.1 of wxPython?

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

wxStyledTextCtrl looks like a highly useful component/widget, but I

haven't

been able to find any documentation for it. Does this exist, or is it

planned

for inclusion in a future release?

Currently only what's in the C++ header file, which is viewable in either of
the wxSTC demos, in wxPython/demo/data/stc.h.html or at
http://wxpython.org/stc.h.html

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!