text wrapping in wx.StaticText

ok heres another problem im having, i have a sizer (wx.FlexGridSizer) that has one column and two rows the row on top has a picture and the row on bottom has the wx.StaticText and everything looks great untill the length of the text is longer than the width of the picture which makes the sizer grow to fit the length of the text, if i change the FlexibleDirection then it stops growing but cuts off the text. is there a way to make the StaticText wrap or is there another alternative besides keeping the text short?

justin mcguire wrote:

ok heres another problem im having, i have a sizer (wx.FlexGridSizer) that has one column and two rows the row on top has a picture and the row on bottom has the wx.StaticText and everything looks great untill the length of the text is longer than the width of the picture which makes the sizer grow to fit the length of the text, if i change the FlexibleDirection then it stops growing but cuts off the text. is there a way to make the StaticText wrap or is there another alternative besides keeping the text short?

The static text control will wrap on some of the platforms if the size it's given is smaller than what it needs, but it's not consistent. What is consistent is that the best size is calculated without taking any wrapping into account. You can however measure the text and insert newlines into the string yourself.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

i had thought of the same, but the issue of measuring the text is that the text is picked up dynamically from a database and there would be no way to make sure that the text would fit before picking it up, i have multiple users entering things and it would be nearly impossible to regulate what they are entering.

···

On 7/31/06, Robin Dunn robin@alldunn.com wrote:

justin mcguire wrote:

ok heres another problem im having, i have a sizer (wx.FlexGridSizer)
that has one column and two rows the row on top has a picture and the
row on bottom has the wx.StaticText
and everything looks great untill
the length of the text is longer than the width of the picture which
makes the sizer grow to fit the length of the text, if i change the
FlexibleDirection then it stops growing but cuts off the text. is there

a way to make the StaticText wrap or is there another alternative
besides keeping the text short?

The static text control will wrap on some of the platforms if the size
it’s given is smaller than what it needs, but it’s not consistent. What

is consistent is that the best size is calculated without taking any
wrapping into account. You can however measure the text and insert
newlines into the string yourself.


Robin Dunn
Software Craftsman

http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

justin mcguire wrote:

i had thought of the same, but the issue of measuring the text is that the text is picked up dynamically from a database and there would be no way to make sure that the text would fit before picking it up, i have multiple users entering things and it would be nearly impossible to regulate what they are entering.

You can measure text at runtime. See wx.DC.GetTextExtent.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!