On 5/19/12 8:14 AM, Steven Wallace wrote:
> In the attached file, the text will wordwrap to the size of the frame in
> a Panel, but not in a ScrolledPanel. I presume that's because the text
> widget was only given as much horizontal space as the frame had for the
> panel, but given unlimited for the scrolled panel. I would like the
> scrolled panel to followthe panel's behavior for horizontal space.
It's because the ScrolledPanel is setting the virtual size based on the
minimum size calculated by the sizer, and that is based on the best size
reported by the static text. So since the best size of a static text is
based on how much space it takes to show the text without wrapping then
that is what you get. Passing scroll_x=False just means don't show that
scrollbar, it has nothing to do with the virtual size of the scrolled
window or the layout of the widgets.
You can try resetting the virtual size of the scrolled panel, although
it wasn't designed with that in mind so there may be some glitches. You
can set the min width of the static text to be your desired width, then
the sizer will use that value instead of the best width. Or you can use
wx.ScrolledWindow instead of ScrolledPanel, and set the virtual size and
etc. how you prefer it.