wx.StaticText acts differently under MSW and GTK

The code below produces different output under MSW and GTK, shown in
attachments.

Under GTK (actually gtk2), it works perfectly. text and text2
line-wrapped and do not overlapped. If you change the size of the
frame, they re-linewrap and move their position to keep non-overlapped.

However, under MSW, the StaticText do not linewrap, thus the trailing
text is invisible.

Well, I know the difference is because of the underline system. But my
application is quite rely on the behaviour under GTK. Is it possible to
emulate the GTK behaviour under MSW?

Unfortunetely, wx.lib.stattext.GenStaticText acts as the MSW one, not
the GTK one. How can I change GenStaticText to emulate StaticText under
GTK?

[code]

import wx

class TestPanel(wx.Panel):
    def __init__(self, *a, **kw):
        wx.Panel.__init__(self, *a, **kw)
        self.text = wx.StaticText(self, -1,
                'This is a very very very very very long sentence.',
                size=(0, -1))
        self.text.SetForegroundColour(wx.BLUE)
        self.text2 = wx.StaticText(self, -1,
                'This is another very very very very very long sentence.',
                size=(0, -1))
        self.text2.SetForegroundColour(wx.RED)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.text, 0, wx.GROW)
        sizer.Add(self.text2, 0, wx.GROW)
        self.SetSizer(sizer)
        self.SetAutoLayout(1)

        wx.CallAfter(self.Layout) # re-layout after init.

class TestFrame(wx.Frame):
    def __init__(self, *a, **kw):
        wx.Frame.__init__(self, *a, **kw)
        self.panel = TestPanel(self)

if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = TestFrame(None, size=(200, 100))
    frame.Show()
    app.MainLoop()

[/code]

gtk.png

win.png

···

--
Qiangning Hong

I'm usually annoyed by IDEs because, for instance, they don't use VIM
as an editor. Since I'm hooked to that, all IDEs I've used so far have
failed to impress me.
    -- Sybren Stuvel @ c.l.python

Get Firefox!
<http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1>