Difficulties with sizers and text controls

I checked this out, and didn't have any luck either. I have
found a few
controls that don't seem to set their size right according to their
contents before. I re-worked your example a little, and added a few
print statements:

         Text2 = wx.TextCtrl(panel, -1, "a really, really, long test"
                             "string imitating locale data",
                             style=wx.TE_READONLY)
         sizer.Add( Text2, 0, wx.EXPAND)
         print "Before calling Layout()"
         print "GetSize: ", Text2.GetSize()
         print "GetBestSize: ", Text2.GetBestSize()

         #panel.SetAutoLayout(True)
         panel.SetSizer(sizer)
         #panel.Layout()
         self.Show()

         print "\nAfter calling Layout()"
         print "GetSize: ", Text2.GetSize()
         print "GetBestSize: ", Text2.GetBestSize()

Here's what I get when I run it:

Before calling Layout()
GetSize: (80, 22)
GetBestSize: (80, 22)
GetAdjustedBestSize: (80, 22)

After calling Layout()
GetSize: (210, 49)
GetBestSize: (80, 22)
GetAdjustedBestSize: (80, 22)

This is with the GridSizer, with the others, the Size does
not change at
all. Looking at this, I understand why the Sizers are doing what they
are, but how can one get the wx.TextCtrl to report the
correct BestSize?

Anyone know?

I modified the sample code to reflect these changes. Additionally,
I added a 4th method: not using sizers, but using wx.Point and
wx.Size, following demoMainLoop.py in the wxPython demo.
This shows other strange behavior: wx.Point and wx.Size
appear to be using different scales. Here is a table of
length of 1st box (from a start point of 0), & starting point of
2nd box, for Linux and Windows:

              length of 1 start point of 2

Linux 60 28

Win2k 51 35

Perhaps this behavior is tied in to the problems some
controls have with reporting the correct BestSize. Ideas?

Thanks, John

label_data2.py (6.69 KB)