Save / Discard / Cancel Dialog

I want to implement a dialog that prompts the user when they attempt to
close a frame with unsaved data. The standard dialog allows you to have
Yes, No and Cancel buttons, but the more user-friendly approach appears
to be (such as in Open Office) Save, Discard and Cancel, or perhaps
Save, Don't Save and Cancel.

I can construct a dialog in wxPython, but is there a way to include the
icons (hand, question mark, stop symbol, etc) that can be displayed in
the standard dialogs? Is there a way to access these icons without
specifically adding icon resources to my application?

Thanks,
Mark

Mark,

I want to implement a dialog that prompts the user when they attempt to
close a frame with unsaved data. The standard dialog allows you to have
Yes, No and Cancel buttons, but the more user-friendly approach appears
to be (such as in Open Office) Save, Discard and Cancel, or perhaps
Save, Don't Save and Cancel.

I can construct a dialog in wxPython, but is there a way to include the
icons (hand, question mark, stop symbol, etc) that can be displayed in
the standard dialogs? Is there a way to access these icons without
specifically adding icon resources to my application?

Thanks,
Mark

You should be able to just subclass wx.Dialog and add whatever buttons you need. The icons you are looking for are probably these:

wx.ICON_ERROR wx.ICON_EXCLAMATION # exclamation mark
wx.ICON_INFORMATION # little "i" info icon
wx.ICON_QUESTION # question mark icon

Mike

Mark,

You should be able to just subclass wx.Dialog and add whatever
buttons you need. The icons you are looking for are probably these:

wx.ICON_ERROR wx.ICON_EXCLAMATION # exclamation mark
wx.ICON_INFORMATION # little "i" info icon
wx.ICON_QUESTION # question mark icon
    
I think that those wx.ICON_* values are just int's that tell the
standard dialog which icon to display. The question is how to get them
to display in a custom dialog or how to get a reference to the icon that
is used.

You're probably right, since those are bitwise operators, I think. It probably refers to the wx.ArtProvider then. I see that it has all of those too.

    * wx.ART_ERROR
    * wx.ART_QUESTION
    * wx.ART_WARNING
    * wx.ART_INFORMATION

See the following link for the full list:

http://www.wxpython.org/docs/api/wx.ArtProvider-class.html

ยทยทยท

On Mon, 2008-06-30 at 09:40 -0500, Mike Driscoll wrote:

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

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org