Grid Size Issue

Suppose I have a window with two grids. I want each grid to be sized to exactly half the window size so I add them both to a BoxSizer and set proportion=1 and flag=wx.EXPAND.

This works perfectly fine if there’s no rows in the grid, but once there are rows the 2nd grid is shrunk down to zero height until all the rows of the first grid are shown. You can see this by resizing the frame vertically. This makes it impossible to use both grids in my application where there could be hundreds or thousands of rows.

I feel like I’m missing something simple here. Using WIT, I can see that both grids have the same minsize of (-1,-1) and they both have the same bestsize (162, 412) in this example. Any ideas?

Windows 7, Python 2.7.3, wxPython 2.9.4.0

Attached is a small sample application to reproduce my problem.

-Kyle Rickey

grid size test.py (767 Bytes)

When I set the MinSize for both grids to (10, 10) it works fine.
It's like it's implicitly calculating the minimum size based on the grid's content when it's set to (-1, -1).

BTW, it works fine unmodified with wx 2.8 (tested on windows).

Cheers,
Toni

···

On Fri, 12 Oct 2012 19:10:37 +0200, Kyle Rickey <kwkard@gmail.com> wrote:

Suppose I have a window with two grids. I want each grid to be sized to
exactly half the window size so I add them both to a BoxSizer and set
proportion=1 and flag=wx.EXPAND.

This works perfectly fine if there's no rows in the grid, but once there
are rows the 2nd grid is shrunk down to zero height until all the rows of
the first grid are shown. You can see this by resizing the frame
vertically. This makes it impossible to use both grids in my application
where there could be hundreds or thousands of rows.

I feel like I'm missing something simple here. Using WIT, I can see that
both grids have the same minsize of (-1,-1) and they both have the same
bestsize (162, 412) in this example. Any ideas?

Windows 7, Python 2.7.3, wxPython 2.9.4.0
Attached is a small sample application to reproduce my problem.

-Kyle Rickey

Thanks Toni, that did the trick. I just stuck SetMinSize(10,10) into my base grid class so that the fix works for all of the grids in my application. Thanks again.

···

On Saturday, October 13, 2012 10:28:37 AM UTC-5, Toni Ruža wrote:

On Fri, 12 Oct 2012 19:10:37 +0200, Kyle Rickey kwk...@gmail.com wrote:

Suppose I have a window with two grids. I want each grid to be sized to

exactly half the window size so I add them both to a BoxSizer and set

proportion=1 and flag=wx.EXPAND.

This works perfectly fine if there’s no rows in the grid, but once there

are rows the 2nd grid is shrunk down to zero height until all the rows of

the first grid are shown. You can see this by resizing the frame

vertically. This makes it impossible to use both grids in my application

where there could be hundreds or thousands of rows.

I feel like I’m missing something simple here. Using WIT, I can see that

both grids have the same minsize of (-1,-1) and they both have the same

bestsize (162, 412) in this example. Any ideas?

Windows 7, Python 2.7.3, wxPython 2.9.4.0

Attached is a small sample application to reproduce my problem.

-Kyle Rickey

When I set the MinSize for both grids to (10, 10) it works fine.

It’s like it’s implicitly calculating the minimum size based on the grid’s content when it’s set to (-1, -1).

BTW, it works fine unmodified with wx 2.8 (tested on windows).

Cheers,

Toni

Hmm, I didn’t want any tabs for this blank space. This listbook is not going to be the main one so a news tab wouldn’t work.

When the program starts up there will be by default no tabs, (then the user will add tabs). When there is no tabs (and therefore no space), it just looks a little awkward.

···

On Monday, October 15, 2012 11:01:13 AM UTC-3, Kyle Rickey wrote:

On Saturday, October 13, 2012 10:28:37 AM UTC-5, Toni Ruža wrote:

On Fri, 12 Oct 2012 19:10:37 +0200, Kyle Rickey kwk...@gmail.com wrote:

Suppose I have a window with two grids. I want each grid to be sized to

exactly half the window size so I add them both to a BoxSizer and set

proportion=1 and flag=wx.EXPAND.

This works perfectly fine if there’s no rows in the grid, but once there

are rows the 2nd grid is shrunk down to zero height until all the rows of

the first grid are shown. You can see this by resizing the frame

vertically. This makes it impossible to use both grids in my application

where there could be hundreds or thousands of rows.

I feel like I’m missing something simple here. Using WIT, I can see that

both grids have the same minsize of (-1,-1) and they both have the same

bestsize (162, 412) in this example. Any ideas?

Windows 7, Python 2.7.3, wxPython 2.9.4.0

Attached is a small sample application to reproduce my problem.

-Kyle Rickey

When I set the MinSize for both grids to (10, 10) it works fine.

It’s like it’s implicitly calculating the minimum size based on the grid’s content when it’s set to (-1, -1).

BTW, it works fine unmodified with wx 2.8 (tested on windows).

Cheers,

Toni

Thanks Toni, that did the trick. I just stuck SetMinSize(10,10) into my base grid class so that the fix works for all of the grids in my application. Thanks again.

Just have a panel of the same size with a static text saying what will
go there - in the same place as the listbook but hide the listbook until
there is a tab then hide the panel - you may need to put both of them in
their own sizers for this to work properly.

Gadget/Steve

···

On 20/10/2012 2:57 PM, Waffle wrote:

Hmm, I didn't want any tabs for this blank space. This listbook is not
going to be the main one so a news tab wouldn't work.

When the program starts up there will be by default no tabs, (then the
user will add tabs). When there is no tabs (and therefore no space),
it just looks a little awkward.