[wxPython-users] Grid Resize overrides layout?
Robin Dunn
robin at alldunn.com
Tue Sep 4 15:34:32 PDT 2007
Mike Driscoll wrote:
> I would still like to know why the Layout() command doesn't work though.
> I've created a sample script that illustrates the problem. When you click
> the button, it changes the font size in cell (0,0) to 12 point Swiss, bold
> and then calls the AutoSize function and then the Layout function. This
> will then cause the grid to change shape slightly and "push" the button
> off the edge of the panel. If you resize the panel with your mouse, the
> button reappears.
You are telling the panel to redo it's layout, but it is still
constrained to the size of the frame. If you want the frame to resize
to meet the new layout needs of the panel, you need to do it yourself.
def onFontChange(self, event):
font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)
self.sheet.SetCellFont(0,0,font)
self.sheet.AutoSize()
#self.panel.Layout()
self.SetClientSize(self.panel.GetBestSize())
Notice that the Layout() is not needed anymore because it will happen
automatically when the resize happens.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list