sizer question

Basic stuff, I know, but I am stuck ....

I am filling a wx.notebook panel with X StaticBoxes
Each box sizer is managed by a wx.StaticBoxSizer
I am dynamically generating a wx.ListCtrl and put it inside the
wx.StaticBoxSizer

Then I create a wx.BoxSizer as a sizer master to manage the X StaticBoxes
and add them to it.

FInally i add my sizer_master to the panel.

All fine so far, except that it does not begave the way I want it to ..

I want the wx.StaticBoxes NOT to resize and have a size (i.e. "column
growth") that displays the whole list. Also, when I am adding a lot of boxes
they tend to overlap ....
What am I missing? Am I using the wrong sizer types? Is my 'sizer
design' wrong?

Cheers and thanks

P.S:
an 'illustration' what I want:

_____________________________sizer_master/ box

sizer_prob.rtf (3.66 KB)

···

  __________________ box1 |
  > > >
  >_______________________| |
  __________________ box2 |
  > > >
  >______________________| |
                                           >

____________________________

box1, box2, ... have the height it takes to disply the whole list,
expand horizontally and are not resizable.

--
--------------------------------------------------
Tobias Weber
CEO

The ROG Corporation GmbH
Donaustaufer Str. 200
93059 Regensburg
Tel: +49 941 4610 57 55
Fax: +49 941 4610 57 56

www.roglink.com

Geschï¿œftsfï¿œhrer: Tobias Weber
Registergericht: Amtsgericht Regensburg - HRB 8954
UStID DE225905250 - Steuer-Nr.184/59359
--------------------------------------------------

I found my 1st problem I guess ....
I was not aware that when one adds sthg to the sizer, the 2nd argument
is really a proportion statement.
So when I go 1,2,3 .... it will automatically lead to overlapping and 0
means that it cannot be resized ...
I found out about it after coming across:
http://wiki.wxpython.org/wxSizer%20in%20python

     ## create the sizer to manage others
        sizer_master = wx.BoxSizer(wx.VERTICAL)
        sizer_master.Add(box1_sizer, 1, wx.EXPAND)
        sizer_master.Add(box2_sizer, 1, wx.EXPAND)
        #sizer_master.Add(box3_sizer, 1, wx.EXPAND)
        #sizer_master.Add(box4_sizer, 1, wx.EXPAND)

···

Am 30.09.11 12:00, schrieb Tobias Weber:

Basic stuff, I know, but I am stuck ....

I am filling a wx.notebook panel with X StaticBoxes
Each box sizer is managed by a wx.StaticBoxSizer
I am dynamically generating a wx.ListCtrl and put it inside the
wx.StaticBoxSizer

Then I create a wx.BoxSizer as a sizer master to manage the X StaticBoxes
and add them to it.

FInally i add my sizer_master to the panel.

All fine so far, except that it does not begave the way I want it to ..

I want the wx.StaticBoxes NOT to resize and have a size (i.e. "column
growth") that displays the whole list. Also, when I am adding a lot of boxes
they tend to overlap ....
What am I missing? Am I using the wrong sizer types? Is my 'sizer
design' wrong?

Cheers and thanks

P.S:
an 'illustration' what I want:

_____________________________sizer_master/ box
> __________________ box1 |
> > > >
> >_______________________| |
> __________________ box2 |
> > > >
> >______________________| |
> >
____________________________

box1, box2, ... have the height it takes to disply the whole list,
expand horizontally and are not resizable.

--
--------------------------------------------------
Tobias Weber
CEO

The ROG Corporation GmbH
Donaustaufer Str. 200
93059 Regensburg
Tel: +49 941 4610 57 55
Fax: +49 941 4610 57 56

www.roglink.com

Gesch�ftsf�hrer: Tobias Weber
Registergericht: Amtsgericht Regensburg - HRB 8954
UStID DE225905250 - Steuer-Nr.184/59359
--------------------------------------------------

Tobias,

I found my 1st problem I guess ....
I was not aware that when one adds sthg to the sizer, the 2nd argument
is really a proportion statement.
So when I go 1,2,3 .... it will automatically lead to overlapping and 0
means that it cannot be resized ...

higher then zero should not cause overlapping - see for definition of proportion:
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Sizer.html#Add

or the "Add summary here:
http://wiki.wxpython.org/UsingSizers

You attached an .rtf which is not very useful if one wants to look at the code and maybe run it.

You might also want to look at the wx.lib.sized_controls - see the wxPython demo.

Werner

···

On 09/30/2011 12:48 PM, Tobias Weber wrote:

Tobias,

I found my 1st problem I guess ....
I was not aware that when one adds sthg to the sizer, the 2nd argument
is really a proportion statement.
So when I go 1,2,3 .... it will automatically lead to overlapping and 0
means that it cannot be resized ...

higher then zero should not cause overlapping - see for definition of
proportion:
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Sizer.html#Add

or the "Add summary here:
UsingSizers - wxPyWiki

I am over it right now... Hoping for a throrough understanding of sizers
... still, ...it's tiresome not to be able to have a simple layout
easily ...
I came across a broken link though:
http://wiki.wxpython.org/UsingSizers
points to a broken link in Point 14:LearnSizers1.py
It finds it under 'smiliar page' then though ...

Thanks

You attached an .rtf which is not very useful if one wants to look at
the code and maybe run it.

DIdn't check thoroughly- damn textedit under OSX .... Won't do it again :slight_smile:

···

Am 30.09.11 16:22, schrieb werner:

On 09/30/2011 12:48 PM, Tobias Weber wrote:

You might also want to look at the wx.lib.sized_controls - see the
wxPython demo.

Werner

--
--------------------------------------------------
Tobias Weber
CEO

The ROG Corporation GmbH
Donaustaufer Str. 200
93059 Regensburg
Tel: +49 941 4610 57 55
Fax: +49 941 4610 57 56

www.roglink.com

Gesch�ftsf�hrer: Tobias Weber
Registergericht: Amtsgericht Regensburg - HRB 8954
UStID DE225905250 - Steuer-Nr.184/59359
--------------------------------------------------

In 2.8 and earlier, if there is not enough space to show all the proportional items then they can be truncated in ways that makes it look like they are overlapping. That has changed in 2.9 as the item's min or best sizes are honored first, and then the leftover space is allocated to the proportional items.

···

On 9/30/11 7:22 AM, werner wrote:

Tobias,

On 09/30/2011 12:48 PM, Tobias Weber wrote:

I found my 1st problem I guess ....
I was not aware that when one adds sthg to the sizer, the 2nd argument
is really a proportion statement.
So when I go 1,2,3 .... it will automatically lead to overlapping and 0
means that it cannot be resized ...

higher then zero should not cause overlapping - see for definition of
proportion:
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Sizer.html#Add

--
Robin Dunn
Software Craftsman

Hi Tobias,

Tobias,

I found my 1st problem I guess ....
I was not aware that when one adds sthg to the sizer, the 2nd argument
is really a proportion statement.
So when I go 1,2,3 .... it will automatically lead to overlapping and 0
means that it cannot be resized ...

higher then zero should not cause overlapping - see for definition of
proportion:
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Sizer.html#Add

or the "Add summary here:
UsingSizers - wxPyWiki

I am over it right now... Hoping for a throrough understanding of sizers
... still, ...it's tiresome not to be able to have a simple layout
easily ...

Sizers are a p.... but one wouldn't want not to have them;-) .

Put the attached into some folder and run lists.py.

Resize the frame, why are two lists not growing? Press ctrl-alt-i to bring up the WIT - your friend in finding out why sizers don't do what you tell them to do:-) .

Hope this helps
Werner

P.S.
sizedstaticbox.py is only needed as current sized_controls don't play nicely out of the box with StaticBox's.

sizedstaticbox.py (1.35 KB)

lists.py (2.34 KB)

···

On 09/30/2011 04:49 PM, Tobias Weber wrote:

Am 30.09.11 16:22, schrieb werner:

On 09/30/2011 12:48 PM, Tobias Weber wrote:

werner wrote:

Hi Tobias,
Sizers are a p.... but one wouldn't want not to have them;-) .

Ain't that the truth. I've used 5 or 6 different widget placement
schemes over the last 20 years. None of them are perfect, but the wx
sizers are among the best of the bunch.

C++ programmers don't often see the need for sizers. When you create
your layouts in an IDE and place controls visually, you think the
problem is solved. But run that app on a machine with a different DPI
or a different sized screen, and suddenly those fixed layouts look
really, really bad.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Many thanks Werner,

I will put it to the test right away....
I am planning on putting together resources on sizers since I see it's
popped up repeatedly on the list over the last years.
I also see that there are many VERY old or unmaintained or uncommented
code snippets and 'tutorials' out there which are simply not right (,
... anymore? ... see [wxPython-users] About wiki - LearnSizers* for
example).
I must admit that even in "wx python in action" I find the chapter on
sizers too 'unstructured' and abstract, I'd prefer a matrix that tells
one 'what position what variable does what ...'. Very often in the book its

Once I feel confident enough to having gotten over the things I am still
struggling with I will definitely structure what I found online (and in
book(s)) and have my shot at a sizer tutorial ....
Any other advises more than welcome.

ThanX and Cheers

···

Am 30.09.11 22:42, schrieb werner:

Hi Tobias,

On 09/30/2011 04:49 PM, Tobias Weber wrote:

Am 30.09.11 16:22, schrieb werner:

Tobias,

On 09/30/2011 12:48 PM, Tobias Weber wrote:

I found my 1st problem I guess ....
I was not aware that when one adds sthg to the sizer, the 2nd argument
is really a proportion statement.
So when I go 1,2,3 .... it will automatically lead to overlapping
and 0
means that it cannot be resized ...

higher then zero should not cause overlapping - see for definition of
proportion:
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Sizer.html#Add

or the "Add summary here:
UsingSizers - wxPyWiki

I am over it right now... Hoping for a throrough understanding of sizers
... still, ...it's tiresome not to be able to have a simple layout
easily ...

Sizers are a p.... but one wouldn't want not to have them;-) .

Put the attached into some folder and run lists.py.

Resize the frame, why are two lists not growing? Press ctrl-alt-i to
bring up the WIT - your friend in finding out why sizers don't do what
you tell them to do:-) .

Hope this helps
Werner

P.S.
sizedstaticbox.py is only needed as current sized_controls don't play
nicely out of the box with StaticBox's.