Can someone look at the attached code and tell me why the pane.Sizer.AddSpacer(1) line causes the labels on the left to grow ridiculously while changing it to a StaticText() doesn't and a line exactly like it farther down also doesn't?
I can certainly use the StaticText as a workaround, I'd really like to know what's going on.
This is Phoenix (3, 0, 1, '.dev76021') on Win7 x64 with Python 2.7.6 x32.
I think the problem is because a sized panel with the type form is a flex grid sizer, so you need to let it know that you want column at index 1 to grow to take up the extra space thats available
If you call the sizers AddGrowableCol method with column index 1 and proportion 1 it behaves as expected.
pane = self.GetContentsPane()
pane.SetSizerType(“form”)
pane.Sizer.AddGrowableCol(1, 1) # ADDED THIS
···
On Friday, February 28, 2014 4:20:29 PM UTC, Michael Hipp wrote:
Can someone look at the attached code and tell me why the
pane.Sizer.AddSpacer(1) line causes the labels on the left to grow ridiculously
while changing it to a StaticText() doesn’t and a line exactly like it farther
down also doesn’t?
I can certainly use the StaticText as a workaround, I’d really like to know
what’s going on.
This is Phoenix (3, 0, 1, ‘.dev76021’) on Win7 x64 with Python 2.7.6 x32.
Thank you, that does seem to make it behave properly. But that doesn't help me understand what's going on.
Why does this cause col 0 to get so big?
pane.Sizer.AddSpacer(1) # THIS CAUSES WAY TOO MUCH SPACE
This doesn't. #wx.StaticText(pane) # THIS DOESN'T
Neither does this (identical line, in later row).
pane.Sizer.AddSpacer(1) # THIS IS NOT A PROBLEM
Whats going on?
Michael
···
On 2/28/2014 11:22 AM, Yoriz wrote:
I think the problem is because a sized panel with the type form is a flex grid sizer, so you need to let it know that you want column at index 1 to grow to take up the extra space thats available
If you call the sizers AddGrowableCol method with column index 1 and proportion 1 it behaves as expected.
pane = self.GetContentsPane()
pane.SetSizerType("form")
pane.Sizer.AddGrowableCol(1, 1) # ADDED THIS
Its not the sizer alone that is causing it to happen its the expand on the control that is in the same row as the spacer
self.addrs.SetSizerProps(expand=True)
if you use the
wx.StaticText(pane) # THIS DOESN’T
and then set the expand property on the control that is in the same row as the second spacer the same thing will happen.
···
On Friday, February 28, 2014 4:20:29 PM UTC, Michael Hipp wrote:
Can someone look at the attached code and tell me why the
pane.Sizer.AddSpacer(1) line causes the labels on the left to grow ridiculously
while changing it to a StaticText() doesn’t and a line exactly like it farther
down also doesn’t?
I can certainly use the StaticText as a workaround, I’d really like to know
what’s going on.
This is Phoenix (3, 0, 1, ‘.dev76021’) on Win7 x64 with Python 2.7.6 x32.
Edit i meant to say its not the spacer alone that is causing it.
···
On Friday, February 28, 2014 4:20:29 PM UTC, Michael Hipp wrote:
Can someone look at the attached code and tell me why the
pane.Sizer.AddSpacer(1) line causes the labels on the left to grow ridiculously
while changing it to a StaticText() doesn’t and a line exactly like it farther
down also doesn’t?
I can certainly use the StaticText as a workaround, I’d really like to know
what’s going on.
This is Phoenix (3, 0, 1, ‘.dev76021’) on Win7 x64 with Python 2.7.6 x32.
There is no expand set on any control in the same /row/ as the offending spacer (what I call row2 in the comments):
pane.Sizer.AddSpacer(1) # THIS CAUSES WAY TOO MUCH SPACE
wx.StaticText(pane, -1, msg)
And wouldn't 'expand' in this case refer to growing in a horizontal direction? The only items that have 'expand' set are in col 1, whereas the problem is col 0.
But you're right, if I comment out the 'expand' on self.addrs lines the problem disappears. I just don't understand how setting expand on an item in col 1 is causing col 0 to grow.
Michael
···
On 2/28/2014 12:02 PM, Yoriz wrote:
On Friday, February 28, 2014 4:20:29 PM UTC, Michael Hipp wrote:
Can someone look at the attached code and tell me why the
pane.Sizer.AddSpacer(1) line causes the labels on the left to grow
ridiculously
while changing it to a StaticText() doesn't and a line exactly like it
farther
down also doesn't?
I can certainly use the StaticText as a workaround, I'd really like to know
what's going on.
This is Phoenix (3, 0, 1, '.dev76021') on Win7 x64 with Python 2.7.6 x32.
Michael
Its not the sizer alone that is causing it to happen its the expand on the control that is in the same row as the spacer
self.addrs.SetSizerProps(expand=True)
if you use the
wx.StaticText(pane) # THIS DOESN'T
and then set the expand property on the control that is in the same row as the second spacer the same thing will happen.
There is no expand set on any control in the same /row/ as the offending spacer (what I call row2 in the comments):
pane.Sizer.AddSpacer(1) # THIS CAUSES WAY TOO MUCH SPACE
wx.StaticText(pane, -1, msg)
And wouldn't 'expand' in this case refer to growing in a horizontal direction? The only items that have 'expand' set are in col 1, whereas the problem is col 0.
But you're right, if I comment out the 'expand' on self.addrs lines the problem disappears. I just don't understand how setting expand on an item in col 1 is causing col 0 to grow.
Could it be the sized_controls.SizedParent.AddChild code: