[wxPython-users] Grid Resize overrides layout?
Robin Dunn
robin at alldunn.com
Sat Sep 1 17:57:42 PDT 2007
Mike Driscoll wrote:
> Hi,
>
> I have a grid control that I'm using for what amounts to a spreadsheet.
> Since some older folks will be using it, I thought I'd try to add the
> ability to change the font size. Alas, I seem to be doing something wrong.
> Currently, my proof of concept code is below:
>
> def onChangeFont(self, event):
> font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)
> self.sheet.SetCellFont(0,0,font)
> self.sheet.AutoSize()
> self.panel.Layout()
>
> The AutoSize command works great, although I wish I it would only resize
> certain columns or rows rather than all of them.
There are AutoSizeRow and AutoSizeColumn methods.
> My problem though is that
> after it "autosizes", some buttons I have below the grid widget are pushed
> "off" the edge of my panel and I have to resize the panel to see them
> again. As I understand it, all I need to do is call Layout, but it doesn't
> work.
>
> In this case, my app is derived from a Frame object, so "self" is a frame.
> I tried calling Layout in the following two ways:
>
> self.Layout() and self.panel.Layout()
If you can produce a small sample we can help better. It should work as
you say, but there could be something about the window/sizer hierarchy
that is short-circuiting the layout.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list