Hello,
I recently upgraded wxPython to 2.5.5.1 (from 2.4.x) on both my
Windows and Linux dev machines and found that my application now has
odd sizer related problems on the Windows side.
It is kind of hard to describe - each call to sizer.Add() creates a
cell that is taller than the previous, so by the time I've added the
last one, the height of that sizer row is many window heights.
A screenshot , to better illustrate is here:
<http://axentra.net/www/hellfroze/sizer.png>
This only occurs under Windows; the Linux version looks fine. The
relevant code snippet is below.
I've read about the changes made to sizers going from 2.4->2.5;
however, no amount of fiddling would fix the Windows problem. In
particular, changing window.SetSize to window.SetMinSize seemed to fix
the sizing, but the label would no longer display.
If I dispense with the added "window", and directly add the StaticText
to the sizer, then the display is correct. However, my tooltips no
longer work!
Any help appreciated,
-Harry
#-- Create a 2 col grid for keyword=>value pairs. The first column
#-- contains the label, the 2nd the actual control for inputing that
#-- keyword's values
gs = wx.FlexGridSizer(len(keywords)+1,2,5,10) # rows,col,vgap,hgap
# +1 for padding...
gs.Add(wx.Size(-1,5))
gs.Add(wx.Size(-1,5))
for keyword in keywords:
#-- The label cell. wxStaticText doesn't do tooltips, so box it
#-- in a wxWindow. This may be a hack
help = "%s\n Default: %s\n Type: %s" % (
K.GetHelp(keyword),
K.GetDefault(keyword),
K.GetType(keyword))
window = wx.Window(self, -1, style=wx.ALIGN_RIGHT)
window.SetToolTip(wx.ToolTip(help))
label = wx.StaticText(window,-1,keyword+":", style=wx.ALIGN_RIGHT)
if K.IsRequired(keyword):
label.SetForegroundColour("#ff0000")
window.SetSize(label.GetSize())
gs.Add(window, 1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
...
Windows: wxPython2.5-unicode-2.5.5.1-py2.3
Linux: wxPython2.5-gtk2-unicode-2.5.5.1-1_py2.3