Custom wx.MessageDialog icons instead of standard wx.ICON_QUESTION, wx.ICON_ERROR, etc.?

Is there any way to change the wx.MessageDialog icons from the defaults?

On the Mac, wx.ICON_QUESTION, wx.ICON_ERROR and wx.ICON_INFORMATION are missing and show a rocket ship, and this needs to be corrected before I can ship my app.

On Windows and Linux, it also might be helpful to show a different icon (say, skinned like the app).

Does anyone know a workable approach?

Thanks.

Hi,

···

On Tuesday, November 19, 2013 3:52:04 AM UTC-6, Edward Sitarski wrote:

Is there any way to change the wx.MessageDialog icons from the defaults?

On the Mac, wx.ICON_QUESTION, wx.ICON_ERROR and wx.ICON_INFORMATION are missing and show a rocket ship, and this needs to be corrected before I can ship my app.

On Windows and Linux, it also might be helpful to show a different icon (say, skinned like the app).

Does anyone know a workable approach?

Thanks.

The MessageDialog wraps the OS’s underlying widget…at least, it’s supposed to. I don’t think you can really change the icons though. However you could switch to the GenericMessageDialog instead or roll your own with a wx.Dialog class.

Mike

Thanks Mike.

Great suggestion about GenericDialog - I keep forgetting to check for generic functionality - generic buttons helped me with a Mac problem earlier.

For the Mac, I will use GenericDialog as my users will be confused with rocket ships instead of error icons.

Look-and-feel is secondary to getting this project done at the moment.

I don;t think it will be too hard to write a wrapper to monkey-patch in GenericDialog to replace MessageDialog (I would like to avoid inline changes in my code)

There may be an issue with separating the “style” flags from MessageDialog and adding them to "awgStyle " in GenericDialog - will have to see how it goes.

When I get it working, I will post the code for anyone else with this problem.

···

On Tuesday, November 19, 2013 4:36:11 PM UTC+1, Mike Driscoll wrote:

Hi,

On Tuesday, November 19, 2013 3:52:04 AM UTC-6, Edward Sitarski wrote:

Is there any way to change the wx.MessageDialog icons from the defaults?

On the Mac, wx.ICON_QUESTION, wx.ICON_ERROR and wx.ICON_INFORMATION are missing and show a rocket ship, and this needs to be corrected before I can ship my app.

On Windows and Linux, it also might be helpful to show a different icon (say, skinned like the app).

Does anyone know a workable approach?

Thanks.

The MessageDialog wraps the OS’s underlying widget…at least, it’s supposed to. I don’t think you can really change the icons though. However you could switch to the GenericMessageDialog instead or roll your own with a wx.Dialog class.

Mike

The monkey-patch was trivial (I should have checked the code before my last post!).

To replace MessageDialog with GenericMessageDialog everywhere, just do the following:

···

#---------------------------------

import wx

import wx.lib.agw.genericmessagedialog

wx.MessageDialog = wx.lib.agw.genericmessagedialog.GenericMessageDialog
#---------------------------------

This fixes the icons on the Mac because the icons are embedded in genericmessagedialog as base64 strings.

Of course, you could also replace the icons in genericmessagedialog.py too. Evil maybe. Just sayin’.

On Tuesday, November 19, 2013 10:47:09 PM UTC+1, Edward Sitarski wrote:

Thanks Mike.

Great suggestion about GenericDialog - I keep forgetting to check for generic functionality - generic buttons helped me with a Mac problem earlier.

For the Mac, I will use GenericDialog as my users will be confused with rocket ships instead of error icons.

Look-and-feel is secondary to getting this project done at the moment.

I don;t think it will be too hard to write a wrapper to monkey-patch in GenericDialog to replace MessageDialog (I would like to avoid inline changes in my code)

There may be an issue with separating the “style” flags from MessageDialog and adding them to "awgStyle " in GenericDialog - will have to see how it goes.

When I get it working, I will post the code for anyone else with this problem.

On Tuesday, November 19, 2013 4:36:11 PM UTC+1, Mike Driscoll wrote:

Hi,

On Tuesday, November 19, 2013 3:52:04 AM UTC-6, Edward Sitarski wrote:

Is there any way to change the wx.MessageDialog icons from the defaults?

On the Mac, wx.ICON_QUESTION, wx.ICON_ERROR and wx.ICON_INFORMATION are missing and show a rocket ship, and this needs to be corrected before I can ship my app.

On Windows and Linux, it also might be helpful to show a different icon (say, skinned like the app).

Does anyone know a workable approach?

Thanks.

The MessageDialog wraps the OS’s underlying widget…at least, it’s supposed to. I don’t think you can really change the icons though. However you could switch to the GenericMessageDialog instead or roll your own with a wx.Dialog class.

Mike