Problem with wx.StaticText()

Hi,

I have localized my wx application and I have problem to display static
text. There is probably a very easy solution, but I didn't find it :frowning:

I have some strings displayed in my windows. I use sizers to manage the
page layout. When the string is translated and longer as the original
string, it get cropped. I'm looking for a way to adapt the size of the
StaticText to the content when the new string is longer than a line (ie
to flow on two lines).

    instructionString = _("Please, read the barcode on your Campus card
with the barcode reader")
    instructionLabel = wx.StaticText(self.panel, -1, instructionString,
size=wx.DefaultSize, style=wx.ALIGN_CENTER)
    instructionLabel.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL,
wx.NORMAL))

    mainSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(instructionLabel, 0, wx.ALIGN_CENTER|
wx.ALIGN_CENTER_VERTICAL)
    [...]
    self.panel.SetSizer(mainSizer)

Thanks for your help or for pointing me to the solution :wink:

Regards
Cedric

路路路

--

C茅dric Gaspoz
Assistant recherche et enseignement
----------------------------------------------------
Universit茅 de Lausanne - Facult茅 des HEC - ISI
Internef 234 T茅l +41 21 692 3408
CH-1015 Lausanne Fax +41 21 692 3405
www.hec.unil.ch/cgaspoz cedric.gaspoz@unil.ch
----------------------------------------------------

Cedric Gaspoz wrote:

Hi,

I have localized my wx application and I have problem to display static
text. There is probably a very easy solution, but I didn't find it :frowning:

I have some strings displayed in my windows. I use sizers to manage the
page layout. When the string is translated and longer as the original
string, it get cropped. I'm looking for a way to adapt the size of the
StaticText to the content when the new string is longer than a line (ie
to flow on two lines).

Decide what the max width in pixels that your text should be and use the Wrap method.

路路路

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