Howdy folks;
I do mostly web apps, but a client needed an offline tool and it gave
me good a reason to finally learn wxPython. I've had a lot of 17 hour
days in the last two weeks trying to meet the deadline, and rely
pretty heavily on google, the wxWiki, and the wxPython in Action book.
But I'm stuck, and the problem is nested deep enough that building the
test case may take longer than fixing it by trial and error. I'm
hoping the collected wisdom of the list could narrow my search for the
fix.
I've got a wxNotebook that contains ScrolledWindows on each page. The
scrolled window uses a vertical BoxSizer. I'm running a loop to fill
the BoxSizer. I'm adding a 3colx1row FlexGridSizer to each cell of
the BoxSizer. The 3-celled FlexGridSizer is set to have it's middle
column grow with flxGrid.AddGrowableCol( 1 )
The problem is this: I have content (multi-line StaticText objects) in
that center column, and am adding more content programatically during
the running of the app. However, no matter how many places I call for
.Layout() or .Refresh() nothing seems to change. I set it like this:
critQuestionSizer.Add( critText, 1,wx.GROW|wx.ALIGN_LEFT|wx.ALL, 6)
Though the FlexGridSizer seems to stretch the middle column
horizontally just fine, I can't seem to find the magic methodto get it
to expand vertically when the content gets bigger.
Thanks in advance for any help or direction. It's my first foray into
the list, so apprise me of any breaches of etiquette I make.
···
--
-----------------------------
e y e p u l p
-----------------------------
Where does your added content go? As I read your post, scrolling down
in your scrolled window should reveal the content. Does it not? Is it
getting placed "off screen", outside the virtual area of the scrolled
window?
···
On 1/12/07, EyePulp <eyepulp@eyepulp.net> wrote:
Howdy folks;
I do mostly web apps, but a client needed an offline tool and it gave
me good a reason to finally learn wxPython. I've had a lot of 17 hour
days in the last two weeks trying to meet the deadline, and rely
pretty heavily on google, the wxWiki, and the wxPython in Action book.
But I'm stuck, and the problem is nested deep enough that building the
test case may take longer than fixing it by trial and error. I'm
hoping the collected wisdom of the list could narrow my search for the
fix.
I've got a wxNotebook that contains ScrolledWindows on each page. The
scrolled window uses a vertical BoxSizer. I'm running a loop to fill
the BoxSizer. I'm adding a 3colx1row FlexGridSizer to each cell of
the BoxSizer. The 3-celled FlexGridSizer is set to have it's middle
column grow with flxGrid.AddGrowableCol( 1 )
The problem is this: I have content (multi-line StaticText objects) in
that center column, and am adding more content programatically during
the running of the app. However, no matter how many places I call for
.Layout() or .Refresh() nothing seems to change. I set it like this:
critQuestionSizer.Add( critText, 1,wx.GROW|wx.ALIGN_LEFT|wx.ALL, 6)
Though the FlexGridSizer seems to stretch the middle column
horizontally just fine, I can't seem to find the magic methodto get it
to expand vertically when the content gets bigger.
Thanks in advance for any help or direction. It's my first foray into
the list, so apprise me of any breaches of etiquette I make.
Hey Chris;
There's two forms of added content: new flexgrids get added to the
boxsizer in the scrolling window. This works fine, and I reset the
scrollbars appropriately with .SetVirtualSize(), and everything works
as expected. Where I run into problems is inside the FlexGridSizers.
One of the areas of content sometimes has more text concatenated onto
an existing StaticText area. The text has line breaks, so it becomes
taller. However, the flexgrid that's holding the statictext doesn;t
respond to the changes in the dimensions of the text.
As I said, I've tried Refreshing using Layout() on a number of the
different objects, but for the life of me can't seem to get the
boxsizer or flex grid to grow bigger vertically.
···
On 1/12/07, Chris Mellon <arkanes@gmail.com> wrote:
On 1/12/07, EyePulp <eyepulp@eyepulp.net> wrote:
> Howdy folks;
> I do mostly web apps, but a client needed an offline tool and it gave
> me good a reason to finally learn wxPython. I've had a lot of 17 hour
> days in the last two weeks trying to meet the deadline, and rely
> pretty heavily on google, the wxWiki, and the wxPython in Action book.
>
> But I'm stuck, and the problem is nested deep enough that building the
> test case may take longer than fixing it by trial and error. I'm
> hoping the collected wisdom of the list could narrow my search for the
> fix.
>
> I've got a wxNotebook that contains ScrolledWindows on each page. The
> scrolled window uses a vertical BoxSizer. I'm running a loop to fill
> the BoxSizer. I'm adding a 3colx1row FlexGridSizer to each cell of
> the BoxSizer. The 3-celled FlexGridSizer is set to have it's middle
> column grow with flxGrid.AddGrowableCol( 1 )
>
> The problem is this: I have content (multi-line StaticText objects) in
> that center column, and am adding more content programatically during
> the running of the app. However, no matter how many places I call for
> .Layout() or .Refresh() nothing seems to change. I set it like this:
> critQuestionSizer.Add( critText, 1,wx.GROW|wx.ALIGN_LEFT|wx.ALL, 6)
>
> Though the FlexGridSizer seems to stretch the middle column
> horizontally just fine, I can't seem to find the magic methodto get it
> to expand vertically when the content gets bigger.
>
> Thanks in advance for any help or direction. It's my first foray into
> the list, so apprise me of any breaches of etiquette I make.
>
Where does your added content go? As I read your post, scrolling down
in your scrolled window should reveal the content. Does it not? Is it
getting placed "off screen", outside the virtual area of the scrolled
window?
--
-----------------------------
e y e p u l p
-----------------------------
<top-post reformatted - please don't top-post in the future>
···
On 1/12/07, EyePulp <eyepulp@eyepulp.net> wrote:
On 1/12/07, Chris Mellon <arkanes@gmail.com> wrote:
> On 1/12/07, EyePulp <eyepulp@eyepulp.net> wrote:
> > Howdy folks;
> > I do mostly web apps, but a client needed an offline tool and it gave
> > me good a reason to finally learn wxPython. I've had a lot of 17 hour
> > days in the last two weeks trying to meet the deadline, and rely
> > pretty heavily on google, the wxWiki, and the wxPython in Action book.
> >
> > But I'm stuck, and the problem is nested deep enough that building the
> > test case may take longer than fixing it by trial and error. I'm
> > hoping the collected wisdom of the list could narrow my search for the
> > fix.
> >
> > I've got a wxNotebook that contains ScrolledWindows on each page. The
> > scrolled window uses a vertical BoxSizer. I'm running a loop to fill
> > the BoxSizer. I'm adding a 3colx1row FlexGridSizer to each cell of
> > the BoxSizer. The 3-celled FlexGridSizer is set to have it's middle
> > column grow with flxGrid.AddGrowableCol( 1 )
> >
> > The problem is this: I have content (multi-line StaticText objects) in
> > that center column, and am adding more content programatically during
> > the running of the app. However, no matter how many places I call for
> > .Layout() or .Refresh() nothing seems to change. I set it like this:
> > critQuestionSizer.Add( critText, 1,wx.GROW|wx.ALIGN_LEFT|wx.ALL, 6)
> >
> > Though the FlexGridSizer seems to stretch the middle column
> > horizontally just fine, I can't seem to find the magic methodto get it
> > to expand vertically when the content gets bigger.
> >
> > Thanks in advance for any help or direction. It's my first foray into
> > the list, so apprise me of any breaches of etiquette I make.
> >
>
> Where does your added content go? As I read your post, scrolling down
> in your scrolled window should reveal the content. Does it not? Is it
> getting placed "off screen", outside the virtual area of the scrolled
> window?
>
Hey Chris;
There's two forms of added content: new flexgrids get added to the
boxsizer in the scrolling window. This works fine, and I reset the
scrollbars appropriately with .SetVirtualSize(), and everything works
as expected. Where I run into problems is inside the FlexGridSizers.
One of the areas of content sometimes has more text concatenated onto
an existing StaticText area. The text has line breaks, so it becomes
taller. However, the flexgrid that's holding the statictext doesn;t
respond to the changes in the dimensions of the text.
As I said, I've tried Refreshing using Layout() on a number of the
different objects, but for the life of me can't seem to get the
boxsizer or flex grid to grow bigger vertically.
This sounds like it might be a wxStaticText bug. Can you check to see
if it's GetBestSize() returns different results before & after you add
the text?
Hey Chris;
There's two forms of added content: new flexgrids get added to the
boxsizer in the scrolling window. This works fine, and I reset the
scrollbars appropriately with .SetVirtualSize(), and everything works
as expected. Where I run into problems is inside the FlexGridSizers.
One of the areas of content sometimes has more text concatenated onto
an existing StaticText area. The text has line breaks, so it becomes
taller. However, the flexgrid that's holding the statictext doesn;t
respond to the changes in the dimensions of the text.
As I said, I've tried Refreshing using Layout() on a number of the
different objects, but for the life of me can't seem to get the
boxsizer or flex grid to grow bigger vertically.
When you initially create the static text do you pass it a size, or otherwise set the min size? That will override what is calculated for the best size (calculated from the font and label) with the sizers and so if it is set then the sizers won't ever change the widget size. See http://wiki.wxpython.org/index.cgi/WindowSizeInfo
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I'm adding a 3colx1row FlexGridSizer to each cell of
the BoxSizer. The 3-celled FlexGridSizer is set to have it's middle
column grow with flxGrid.AddGrowableCol( 1 )
I have no idea if this will help, but why not a BoxSizer(wx.HORIZONTAL) here instead of a FlexGridSizer?
Though the FlexGridSizer seems to stretch the middle column
horizontally just fine, I can't seem to find the magic methodto get it
to expand vertically when the content gets bigger.
Maybe flxGrid.AddGrowableCRow( 0 ) ?
If this doesn't work, you really should try to isolate the problem -- you learn a lot that way, and if it's that hard, your app could use some re-structuring!
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
This sounds like it might be a wxStaticText bug. Can you check to see
if it's GetBestSize() returns different results before & after you add
the text?
This sounds like a promising way to identify (or eliminate) one of the
possible areas causing the problem; actually, it's not a problem so
much as a lack of my experience with wx =)
Robin:
I've tried so many different approaches that I believe I did force the
size on occasion just to see if I had some direct control. Nothing
changed, and I rolled the code back (I hope!) so that I'm starting
fresh now. I'll read up on WindowSizeInfo. BTW - in the last week
and a half of being plunged into this (self imposed) wxPython
education, I can't say how many Google results to my questions had
your name stuck on the end. Thanks for all your work here. I'm happy
to escape the MS development treadmill finally.
Chris B:
I did try the flxGrid.AddGrowableRow(0) at one point - but I may have
had other things hampering it at that point - It seems like it would
be worth a try again.
I'm going to try and build a test case if these attempts don't fix anything.
···
--
-----------------------------
e y e p u l p
-----------------------------
Well, I've made little progress over the last few hours of teeth
gnashing. But I think I have a firmer grip on the symptoms of my
problem.
I have a notebook. Each page has a scrolled window attached. The
sizer for the scrolled window is a vertical BoxSizer. Each "entry" in
the vertical BoxSizer is a FlexGridSizer that contains 2 columns, with
the right column containing a StaticText widget that gets changed with
new text over the life of the app. The label might have multiple
lines (\n) in it, but the problem I have is the BoxSizer doesn't seem
to want to update when that text changes. I've tested by forcing the
MinSize of the StaticText to something very tall, and the scrolled
window locks in a very tall vertical height. I also "know" the
correct current height for each StaticText by checking it's
self.GetBestSize()[0] value. But even if I re-set the StaticText with
.SetMinSize(self.GetBestSize()) every time the text changes, the
vertical BoxSizer never seems to re-adjust the height of its cells to
encompass the changes.
*sigh*
I'm still trying to build an accurate test case to illustrate the
problem - unfortunately my wxPython skills are so lacking that even
building a test case is quite an undertaking. =)
The issue seems to be on how to get he BoxSizer to re-evaluate the
height dimensions of the children inside of it. Is each cell of a box
sizer required to be the same height? Perhaps I need to use a flex
grid instead.
Any thoughts are welcome.
···
--
-----------------------------
e y e p u l p
-----------------------------
Well, I've made little progress over the last few hours of teeth
gnashing. But I think I have a firmer grip on the symptoms of my
problem.
I have a notebook. Each page has a scrolled window attached. The
sizer for the scrolled window is a vertical BoxSizer. Each "entry" in
the vertical BoxSizer is a FlexGridSizer that contains 2 columns, with
the right column containing a StaticText widget that gets changed with
new text over the life of the app. The label might have multiple
lines (\n) in it, but the problem I have is the BoxSizer doesn't seem
to want to update when that text changes. I've tested by forcing the
MinSize of the StaticText to something very tall, and the scrolled
window locks in a very tall vertical height. I also "know" the
correct current height for each StaticText by checking it's
self.GetBestSize()[0] value. But even if I re-set the StaticText with
.SetMinSize(self.GetBestSize()) every time the text changes, the
vertical BoxSizer never seems to re-adjust the height of its cells to
encompass the changes.
*sigh*
I'm still trying to build an accurate test case to illustrate the
problem - unfortunately my wxPython skills are so lacking that even
building a test case is quite an undertaking. =)
The issue seems to be on how to get he BoxSizer to re-evaluate the
height dimensions of the children inside of it. Is each cell of a box
sizer required to be the same height? Perhaps I need to use a flex
grid instead.
Any thoughts are welcome.
I often find that I start using a BoxSizer like you did and then change it to a flexgridsizer. Depending on your layout this might be your problem.
Can you take the screen in question and remove external dependencies (database stuff etc) and post it here as an attachment. At least for me being able to look at the layout and the code makes it much easier to come up with some suggestions and maybe even corrections.
Hey Werner;
Around 2am last night I made the brilliant discovery of using a
flexGridSizer, which, though my problem persists, I decided wasn't the
hill I wanted to die on. I set a MinHeight to force things to the
largest needed size, and have moved forward. I think wxPython won
this round, but I can't say it wasn't very educational.
I'll tackle the issue in v.2 of this app. =) Plenty of other issues remain.
···
On 1/14/07, Werner F. Bruhin <werner.bruhin@free.fr> wrote:
Hi,
EyePulp wrote:
> Well, I've made little progress over the last few hours of teeth
> gnashing. But I think I have a firmer grip on the symptoms of my
> problem.
>
> I have a notebook. Each page has a scrolled window attached. The
> sizer for the scrolled window is a vertical BoxSizer. Each "entry" in
> the vertical BoxSizer is a FlexGridSizer that contains 2 columns, with
> the right column containing a StaticText widget that gets changed with
> new text over the life of the app. The label might have multiple
> lines (\n) in it, but the problem I have is the BoxSizer doesn't seem
> to want to update when that text changes. I've tested by forcing the
> MinSize of the StaticText to something very tall, and the scrolled
> window locks in a very tall vertical height. I also "know" the
> correct current height for each StaticText by checking it's
> self.GetBestSize()[0] value. But even if I re-set the StaticText with
> .SetMinSize(self.GetBestSize()) every time the text changes, the
> vertical BoxSizer never seems to re-adjust the height of its cells to
> encompass the changes.
>
> *sigh*
>
> I'm still trying to build an accurate test case to illustrate the
> problem - unfortunately my wxPython skills are so lacking that even
> building a test case is quite an undertaking. =)
>
> The issue seems to be on how to get he BoxSizer to re-evaluate the
> height dimensions of the children inside of it. Is each cell of a box
> sizer required to be the same height? Perhaps I need to use a flex
> grid instead.
>
> Any thoughts are welcome.
I often find that I start using a BoxSizer like you did and then change
it to a flexgridsizer. Depending on your layout this might be your problem.
Can you take the screen in question and remove external dependencies
(database stuff etc) and post it here as an attachment. At least for me
being able to look at the layout and the code makes it much easier to
come up with some suggestions and maybe even corrections.
Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
--
-----------------------------
e y e p u l p
-----------------------------