Sizers/fitting questions

I'm using Python 2.3.2, wxPython 2.5.2.7.

In the attached file, I have
a Frame
    containing a Notebook (subclass)
       with one page
          with a GridBagSizer
             that lays out several widgets.

Unfortunately, the contents of the Notebook
page are truncated on the right.

My questions:

1. How can I make the notebook & frame expand to show
the entire GridBagSizer when it opens? It currently
cuts off the right-hand side of the GridBagSizer, but
the Notebook appears to draw correctly, so I think my
problem is in getting the Notebook to expand to fit
the GridBagSizer, then getting the Frame to expand to
fit the Notebook.

2. Is there a way to automatically determine the laid-out
size of the GridBagSizer so I can set the min size of the
notebook/frame (so that the window can grow larger than
that, but not smaller).

3. Is there a way to tell the GridBagSizer to expand a
the contents of a particular cell (there is no proportion
parameter to GridBagSizer.Add).

I've spent the last 4+ hours going back and forth between
the demo, the wxWidgets docs, and the code trying to
find the answers, to no avail.

- Sam

RecipientEditPanel.py (3 KB)

···

__________________________________________________________
Spinward Stars, LLC Samuel Reynolds
Software Consulting and Development 303-805-1446
http://SpinwardStars.com/ sam@SpinwardStars.com

Change your PanelTestFrame to:
class PanelTestFrame( wx.Frame ):
def init(self, parent, title):
wx.Frame.init(self, parent, -1, title, pos=(150, 150), size=(250, 200) )

		          # Create the test panel
		          panel = TEST_PANEL_CLASS(self)

panel.Layout()

panel.Fit()
self.Fit()

The bolded lines are the lines that were added. Don’t feel bad, because I just asked the same question yesterday but on the mac list. :smiley:

Greg Hasseler

Dodgeram01

···

On Sat, 2004-08-28 at 15:22, Samuel Reynolds wrote:

*
I'm using Python 2.3.2, wxPython 2.5.2.7.
In the attached file, I have
a Frame
containing a Notebook (subclass)
with one page
with a GridBagSizer
that lays out several widgets.
Unfortunately, the contents of the Notebook
page are truncated on the right.
My questions:
1. How can I make the notebook & frame expand to show
the entire GridBagSizer when it opens? It currently
cuts off the right-hand side of the GridBagSizer, but
the Notebook appears to draw correctly, so I think my
problem is in getting the Notebook to expand to fit
the GridBagSizer, then getting the Frame to expand to
fit the Notebook.
2. Is there a way to automatically determine the laid-out
size of the GridBagSizer so I can set the min size of the
notebook/frame (so that the window can grow larger than
that, but not smaller).
3. Is there a way to tell the GridBagSizer to expand a
the contents of a particular cell (there is no proportion
parameter to GridBagSizer.Add).
I've spent the last 4+ hours going back and forth between
the demo, the wxWidgets docs, and the code trying to
find the answers, to no avail.
- Sam
__________________________________________________________
Spinward Stars, LLC Samuel Reynolds
Software Consulting and Development 303-805-1446*
[http://SpinwardStars.com/](http://SpinwardStars.com/)            sam@SpinwardStars.com

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

Try this for your test panel:

    class PanelTestFrame( wx.Frame ):
    
  def __init__(self, parent, title):
            wx.Frame.__init__(self, parent, -1, title,
                            pos=(150, 150), size=(250, 200),
                    )
            
            # Create the test panel
            panel = TEST_PANEL_CLASS(self)
            sizer = wx.BoxSizer( wx.VERTICAL )
            sizer.Add( panel, 1, wx.ALL|wx.EXPAND)
            self.SetSizer( sizer )
            sizer.SetSizeHints( self )

Donnal Walter
Arkansas Children's Hospital

···

--- Samuel Reynolds <sam@SpinwardStars.com> wrote:

I've spent the last 4+ hours going back and forth between
the demo, the wxWidgets docs, and the code trying to
find the answers, to no avail.

That did the trick! I'd tried each separately;
I didn't think to work from the inside out.

- Sam

···

At 2004-08-29 10:52 AM -0400, you wrote:

Change your PanelTestFrame to:

    class PanelTestFrame( wx.Frame ):
        def __init__(self, parent, title):
           wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(250, 200) )

          # Create the test panel
          panel = TEST_PANEL_CLASS(self)
# panel.Layout()
          panel.Fit()
          self.Fit()

__________________________________________________________
Spinward Stars, LLC Samuel Reynolds
Software Consulting and Development 303-805-1446
http://SpinwardStars.com/ sam@SpinwardStars.com

Samuel Reynolds wrote:

I'm using Python 2.3.2, wxPython 2.5.2.7.

In the attached file, I have
a Frame
   containing a Notebook (subclass)
      with one page
         with a GridBagSizer
            that lays out several widgets.

Unfortunately, the contents of the Notebook
page are truncated on the right.

My questions:

1. How can I make the notebook & frame expand to show
the entire GridBagSizer when it opens? It currently
cuts off the right-hand side of the GridBagSizer, but
the Notebook appears to draw correctly, so I think my
problem is in getting the Notebook to expand to fit
the GridBagSizer, then getting the Frame to expand to
fit the Notebook.

This has already been answered...

2. Is there a way to automatically determine the laid-out
size of the GridBagSizer so I can set the min size of the
notebook/frame (so that the window can grow larger than
that, but not smaller).

Use sizer.CalcMin()

3. Is there a way to tell the GridBagSizer to expand a
the contents of a particular cell (there is no proportion
parameter to GridBagSizer.Add).

The wx.EXPAND flag will tell the item to fill the whole cell.

···

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