wxPython 2.9 - wx.MessageBox does not look native on Windows 7

Hi all!

I have been avoiding wxPython 2.9 for years because every time I tried to use it it broke layout of all my apps in a certain way. Yesterday I thought that it is time to try again - and this time be more thorough on investigating why is my layout broken…

Well, I have found that default size of buttons changed to slightly bigger (from (75, 23) to (88, 26)) which in effect changed size of nearly everything in my sizers. Not a big deal as I can fix my layouts to accommodate for this. I thought that it is fine (even when annoying) because I have noticed that system dialogs started to use bigger buttons in Windows 7 too so it is going to be more consistent.

But then during my testing I have noticed that in 2.9 in fact message box does not have a new bigger button. And that is does not look like the native system message box either. Also it does not center if there is another window on screen. However it works fine in 2.8, also the message box is perfectly matching the system one.

Can someone elaborate on the changes introduced in 2.9? Should I wait and still use 2.8? I am confused :-).

Thanks

size_test.py (1.41 KB)

···


Fenikso

Hi Fenikso,

Hi all!

I have been avoiding wxPython 2.9 for years because every time I tried to use it it broke layout of all my apps in a certain way. Yesterday I thought that it is time to try again - and this time be more thorough on investigating why is my layout broken...

Well, I have found that default size of buttons changed to slightly bigger (from (75, 23) to (88, 26)) which in effect changed size of nearly everything in my sizers. Not a big deal as I can fix my layouts to accommodate for this. I thought that it is fine (even when annoying) because I have noticed that system dialogs started to use bigger buttons in Windows 7 too so it is going to be more consistent.

But then during my testing I have noticed that in 2.9 in fact message box does not have a new bigger button. And that is does not look like the native system message box either. Also it does not center if there is another window on screen. However it works fine in 2.8, also the message box is perfectly matching the system one.

Can someone elaborate on the changes introduced in 2.9? Should I wait and still use 2.8? I am confused :-).

I would think it is a good time to switch to 2.9, especially in preparation for Phoenix.

Sizers have changed a bit in 2.9, which probably is an additional reason for you layout issues.

Have you seen the "site-packages/wx-2.9.5-msw/docs/CHANGES.html"

Just looked at 2.8 and 2.9 MessageDialog in the demo and they look just about the same, the 2.9 is slightly larger and this is on Win 7.

Werner

···

On 09/04/2013 09:48, Fenikso wrote:

Hi Fenikso,

Didn't pay attention to your attached test script before, here my output, which I guess confirm your findings.

2.8:
(wx.Size(94, 23), wx.Size(-1, -1))
(wx.Size(200, 23), wx.Size(200, -1))
(75, 23)

Message box 1 wxPy: middle of my screen
Message box 2 native: middle of my screen

Both MB's have the same size

2.9 Phoenix:
(wx.Size(102, 26), wx.Size(-1, -1))
(wx.Size(200, 26), wx.Size(200, -1))
(88, 26)

Message box 1 wxPy: top left
Message box 2 native: middle of my screen

First MB is wider

Werner

Hi Werner,

Thanks for the reply. I have been looking at the document and I did not notice any sizer changes. Anyway, it seems that my layout issue is that I am relying on wx.TextCtrl having roughly same height as wx.Button in 2.8 (21 vs 23 px) which is not true anymore in 2.9 (21 vs 26 px).

However MessageBox does not seem right to me. In demo using MessageDialog it looks roughly the same. But in my example (attached to fist post) it is quite different and does not center itself when using MessageBox. I have attached screenshot. I have been experimenting with various versions so maybe there is something wrong with my installation.

messagebox.png

···


Fenikso

Yes, this is exactly what I get. Thanks for checking out.

···


Fenikso

Dne úterý, 9. dubna 2013 11:03:48 UTC+2 werner napsal(a):

Hi Fenikso,

Didn’t pay attention to your attached test script before, here my
output, which I guess confirm your findings.

2.8:

(wx.Size(94, 23), wx.Size(-1, -1))

(wx.Size(200, 23), wx.Size(200, -1))

(75, 23)

Message box 1 wxPy: middle of my screen

Message box 2 native: middle of my screen

Both MB’s have the same size

2.9 Phoenix:

(wx.Size(102, 26), wx.Size(-1, -1))

(wx.Size(200, 26), wx.Size(200, -1))

(88, 26)

Message box 1 wxPy: top left

Message box 2 native: middle of my screen

First MB is wider

Werner

Hi Fenikso,

Hi Werner,

Thanks for the reply. I have been looking at the document and I did not notice any sizer changes.

In 2.9.01 there is:
Sizers distribute only the extra space between the stretchable items according to their proportions and not all available space. We believe the new behaviour corresponds better to user expectations but if you did rely on the old behaviour you will have to update your code to set the minimal sizes of the sizer items to be in the same proportion as the items proportions to return to the old behaviour.

You are using GridBagSizer, there is also in 2.8.8.1:
Fixed a bug in wx.GridBagSizer where hidden items were not ignored in part of the layout algorithm.

There is also the SetEmptyCellSize thingy which caught me a few times.

http://wiki.wxpython.org/wxGridBagSizer

Werner

···

On 09/04/2013 11:04, Fenikso wrote:

Fenikso wrote:

But then during my testing I have noticed that in 2.9 in fact message
box does not have a new bigger button. And that is does not look like
the native system message box either. Also it does not center if there
is another window on screen. However it works fine in 2.8, also the
message box is perfectly matching the system one.

IIRC, in 2.9 we switched to the native TaskDialog instead of using the old MessageBox API.

This lets us do things like change button labels and some other capabilities. It will fallback to the old MessageBox if the task dialog is not available (like on XP or if the library was built with an old SDK, etc.)

···

--
Robin Dunn
Software Craftsman

Thanks for the explanation. However something is probably broken if the MessageBox does not center itself, the center flag should be default if I am not mistaken. And I guess I cannot actually control the TaskDialog aspects as described here About Task Dialogs - Win32 apps ?

···


Fenikso

Dne úterý, 9. dubna 2013 23:07:13 UTC+2 Robin Dunn napsal(a):

IIRC, in 2.9 we switched to the native TaskDialog instead of using the
old MessageBox API.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb787471(v=vs.85).aspx

This lets us do things like change button labels and some other
capabilities. …


Robin Dunn

Software Craftsman

http://wxPython.org

Fenikso wrote:

Thanks for the explanation. However something is probably broken if the
MessageBox does not center itself, the center flag should be default if
I am not mistaken. And I guess I cannot actually control the TaskDialog
aspects as described here
About Task Dialogs - Win32 apps
?

No, but you can do the things described here: wxWidgets: wxMessageDialog Class Reference :wink:

BTW, in my tests it looks like it is centered over the parent or over the tlw set as the app object's top window if no parent is given. If you look closer at the docs it does say that the center flag is ignored on MSW.

···

--
Robin Dunn
Software Craftsman