I am working on an automatic layout algorithm, generating controls and
placing them in boxsizers.
When I find a control and call GetSizer(), the program returns None.
Even after layout.
In the WIT, I can select the control, see it's in a boxsizer, and
obj.GetSizer() returns None.
System and wx versions:
2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
2.8.10.1 (msw-unicode)
What circumstances could prevent GetSizer() from returning the actual
sizer? Or, has it been so long since I worked with this I've forgotten
something vital?
I have a created a sample app that is giving the same grief.
obj.GetSizer gives you the sizer used to manage the layout obj's children, not the layout of obj and its siblings on their parent. If that is what you want then use GetContainingSizer.
···
On 10/21/10 11:30 AM, Josh English wrote:
I am working on an automatic layout algorithm, generating controls and
placing them in boxsizers.
When I find a control and call GetSizer(), the program returns None.
Even after layout.
In the WIT, I can select the control, see it's in a boxsizer, and
obj.GetSizer() returns None.
System and wx versions:
2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
2.8.10.1 (msw-unicode)
What circumstances could prevent GetSizer() from returning the actual
sizer? Or, has it been so long since I worked with this I've forgotten
something vital?
Consider this dope slapped in the back of the head.
I went back and played with GetSizer and finally trolled the Get_
methods in the WIT to find this one.
Thanks.
Josh
···
On Thu, Oct 21, 2010 at 11:38 AM, Robin Dunn <robin@alldunn.com> wrote:
On 10/21/10 11:30 AM, Josh English wrote:
I am working on an automatic layout algorithm, generating controls and
placing them in boxsizers.
When I find a control and call GetSizer(), the program returns None.
Even after layout.
In the WIT, I can select the control, see it's in a boxsizer, and
obj.GetSizer() returns None.
System and wx versions:
2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
2.8.10.1 (msw-unicode)
What circumstances could prevent GetSizer() from returning the actual
sizer? Or, has it been so long since I worked with this I've forgotten
something vital?
obj.GetSizer gives you the sizer used to manage the layout obj's children,
not the layout of obj and its siblings on their parent. If that is what you
want then use GetContainingSizer.
What I want to do is change the sizer proportion and flag after layout. (This is
a generated layout and I want to tweak certain bits.)
I see the control is in a sizer, which has children of sizeritems. Is
it possible
to get that SizerItem and change the proportion flag?
I've got a heirarchy of box sizers, so if I want to add the wx.GROW flag to one
control, I need to add it to the SizerItem, and the Sizer, don't I?
Josh
···
On Thu, Oct 21, 2010 at 11:40 AM, Josh English <joshua.r.english@gmail.com> wrote:
Consider this dope slapped in the back of the head.
I went back and played with GetSizer and finally trolled the Get_
methods in the WIT to find this one.
Thanks.
Josh
On Thu, Oct 21, 2010 at 11:38 AM, Robin Dunn <robin@alldunn.com> wrote:
On 10/21/10 11:30 AM, Josh English wrote:
I am working on an automatic layout algorithm, generating controls and
placing them in boxsizers.
When I find a control and call GetSizer(), the program returns None.
Even after layout.
In the WIT, I can select the control, see it's in a boxsizer, and
obj.GetSizer() returns None.
System and wx versions:
2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
2.8.10.1 (msw-unicode)
What circumstances could prevent GetSizer() from returning the actual
sizer? Or, has it been so long since I worked with this I've forgotten
something vital?
obj.GetSizer gives you the sizer used to manage the layout obj's children,
not the layout of obj and its siblings on their parent. If that is what you
want then use GetContainingSizer.
Currently, wxPython is telling me wx.GROW and wx.EXPAND are both 8192.
Shouldn't they be different values?
Josh
···
On Thu, Oct 21, 2010 at 12:08 PM, Robin Dunn <robin@alldunn.com> wrote:
On 10/21/10 11:54 AM, Josh English wrote:
Okay, now I have a follow-up.
What I want to do is change the sizer proportion and flag after layout.
(This is
a generated layout and I want to tweak certain bits.)
I see the control is in a sizer, which has children of sizeritems. Is
it possible
to get that SizerItem and change the proportion flag?
I've got a heirarchy of box sizers, so if I want to add the wx.GROW flag
to one
control, I need to add it to the SizerItem, and the Sizer, don't I?
Something like this should work:
item = sizer\.GetItem\(widget\)
if item:
\# changing flags
item\.SetFlag\(item\.GetFlag\(\)|wx\.GROW\)
\# or changing the proportion
item\.SetProportion\(2\)
I thought one was supposed to expand to fill the available space, and
the other automatically grow the control when the window size changes.
Josh
···
On Thu, Oct 21, 2010 at 5:18 PM, Steven Sproat <sproaty@gmail.com> wrote:
On 22/10/2010 00:02, Josh English wrote:
Arg. And I mean this from the bottom of my heart.
Currently, wxPython is telling me wx.GROW and wx.EXPAND are both 8192.
Shouldn't they be different values?
Josh
On Thu, Oct 21, 2010 at 12:08 PM, Robin Dunn<robin@alldunn.com> wrote:
On 10/21/10 11:54 AM, Josh English wrote:
Okay, now I have a follow-up.
What I want to do is change the sizer proportion and flag after layout.
(This is
a generated layout and I want to tweak certain bits.)
I see the control is in a sizer, which has children of sizeritems. Is
it possible
to get that SizerItem and change the proportion flag?
I've got a heirarchy of box sizers, so if I want to add the wx.GROW flag
to one
control, I need to add it to the SizerItem, and the Sizer, don't I?
Something like this should work:
item = sizer\.GetItem\(widget\)
if item:
\# changing flags
item\.SetFlag\(item\.GetFlag\(\)|wx\.GROW\)
\# or changing the proportion
item\.SetProportion\(2\)
If I change the TextCtrl, buried three sizers into the layout, I can
get its containing sizer, and the sizer item that controls it, but
that's it.
I need to also change the sizeritem in the staticboxsizer that
contains the box sizer that contains the control, otherwise changing
the proportion on the sizeritem containing the control doesn't do
enough.
Unless there's a secret method, I have to recreate the sizer tree.
And as these sizers and controls are being generated by another
script, I can't create them this way, I need to tweak them after
creation and layout.
Josh
···
On Thu, Oct 21, 2010 at 7:02 PM, C M <cmpython@gmail.com> wrote:
On Thu, Oct 21, 2010 at 8:40 PM, Josh English > <joshua.r.english@gmail.com> wrote:
I thought one was supposed to expand to fill the available space, and
the other automatically grow the control when the window size changes.
Note that in wx.Python there is the method .SetBackgroundColour() but no synonym .SetBackgroundColor(). The same is true for the class variable ctrl**.BackgroundColour** and ctrl**.BackgroundColor**
···
On Thu, Oct 21, 2010 at 5:18 PM, Steven Sproat sproaty@gmail.com wrote:
On 22/10/2010 00:02, Josh English wrote:
Arg. And I mean this from the bottom of my heart.
Currently, wxPython is telling me wx.GROW and wx.EXPAND are both 8192.
Shouldn’t they be different values?
No, they both have the same operation and are just synonyms, like