SendSizeEvent() not working in Windows XP?

Hi!

So, I've been working on this app. The specifics are unimportant, but
when I tried running my code in Windows XP, after about a month of
painstaking work in my main OS Ubuntu, I discovered a problem...

Among other things, I allow the user to change the font size of the
widgets in the GUI. And, since this also modifies the width of the
widgets themselves, I need to call Layout() to make everything flow
smoothly into place. In Linux, this works perfectly. All widgets are
resized.

In Windows, however... The font sizes are changed, but the widgets
aren't. The only way to update the layout seems to be to change the
size of the window manually, by using the mouse. If the window's size
is changed even slightly, the widgets are all resized to accomodate
the new font sizes.

This led me to believe that a SendSizeEvent() would be a good
solution. However, it seems to do absolutely nothing. At least, it
didn't fix my problem. How the heck!? Isn't a SendSizeEvent()
basically exactly what happens when you resize a window, or does XP
use some other, special way of deciding when to relayout the whole
thing?

Any help or suggestions appreciated.

Thanks.

Mikael "Krank" Bergström

Hi,

···

On Jan 10, 5:20 am, Krank <kran...@gmail.com> wrote:

Hi!

So, I've been working on this app. The specifics are unimportant, but
when I tried running my code in Windows XP, after about a month of
painstaking work in my main OS Ubuntu, I discovered a problem...

Among other things, I allow the user to change the font size of the
widgets in the GUI. And, since this also modifies the width of the
widgets themselves, I need to call Layout() to make everything flow
smoothly into place. In Linux, this works perfectly. All widgets are
resized.

In Windows, however... The font sizes are changed, but the widgets
aren't. The only way to update the layout seems to be to change the
size of the window manually, by using the mouse. If the window's size
is changed even slightly, the widgets are all resized to accomodate
the new font sizes.

This led me to believe that a SendSizeEvent() would be a good
solution. However, it seems to do absolutely nothing. At least, it
didn't fix my problem. How the heck!? Isn't a SendSizeEvent()
basically exactly what happens when you resize a window, or does XP
use some other, special way of deciding when to relayout the whole
thing?

Any help or suggestions appreciated.

Thanks.

Mikael "Krank" Bergström

You may not be calling Layout() on the right widget. When I add or
delete a widget to a panel, I have to call the panel's Layout()
method. You may need to throw in a Refresh() as well.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

PyCon 2010 Atlanta Feb 19-21 http://us.pycon.org/

Hi!

I managed to solve the problem. It turns out that if I call Layout() or Refresh() on an item, it doesn't automatically pass that call down to its siblings in Windows. In Ubuntu/GTK, if I call Layout on my wx.Frame, all items within that frame also seem to get updated. In order to make the whole thing work in Windows, I need to call Layout() and Refresh() explicitly at least for every sizer and panel I want to update.

Annoying, but manageable.

//Krank

···

You may not be calling Layout() on the right widget. When I add or
delete a widget to a panel, I have to call the panel's Layout()
method. You may need to throw in a Refresh() as well.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

PyCon 2010 Atlanta Feb 19-21 http://us.pycon.org/