Loading Sizers from XRC then resizing objects

wxPython-users,

In my application, I load a wxPanel from a XRC file using LoadPanel().
The XRC contains a wxFlexGridSizer and inside that are some wxButtons.

It loads and displays very nicely.
After the user performs some action, I wish to resize one of the
buttons. The code is:

XRCCTRL(self, "xOk").SetSize((200, 200))

But the button does not resize.
I tried calling Layout() on the wxFlexGridSizer, and the wxPanel.
I tried Fit() too.
I treid RecalcSizes() on the wxFlexGridSizer too.

What am I doing wrong?

(I know you can set the of the size the button in the XRC file, but I
wish to change the button size multiple times during the execution of
the program.)

Thanks in advance,
Craig

Oxyde wrote:

wxPython-users,

In my application, I load a wxPanel from a XRC file using LoadPanel().
The XRC contains a wxFlexGridSizer and inside that are some wxButtons.

It loads and displays very nicely.
After the user performs some action, I wish to resize one of the buttons. The code is:

XRCCTRL(self, "xOk").SetSize((200, 200))

But the button does not resize.
I tried calling Layout() on the wxFlexGridSizer, and the wxPanel.
I tried Fit() too.
I treid RecalcSizes() on the wxFlexGridSizer too.

What am I doing wrong?

You need to tell the sizer that the button has a new minimum size, otherwise it doesn't know the difference between you calling SetSize and the sizer calling SetSize.

  theSizer.SetItemMinSize(XRCCTRL(self, "xOk"), 200, 200)
  theSizer.Layout()

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!