If you need it for non standard dialogs, i.e. a dialog you create then
the label is totally up to you (see attached).
If you haven't already done so have a look at the wxPython demo, bottom
left search for "dialog" and for "stock", the first search will show you
all the available dialogs and the second gives you the available stock
buttons.
Werner
As I recall, we don't always have access to every widget in a wx.MessageDialog because the OS itself doesn't allow it. Remember, wxPython wraps the native widgets where ever possible. This may be one of those cases. If so, then rolling your own wx.Dialog is the way to go. It's really not that hard.
The problem is that wx.MessageDialog is not a real wx.Dialog, it is just
a wrapper around a native API function. So there is no wx.Button that
can be found with one of the Find methods. There is a generic message
dialog class in wx.lib.agw that you can use instead that is a real
wx.Dialog and is also implemented in Python code, so it is easy to
override behavior as needed. I also recently added a MultiMessageDialog
class in wx.lib.dialogs that is much like a wx.MessageDialog but it is
able to have an extra block of text that is scrollable and it explicitly
supports changing the labels of the stock buttons.
--
Robin Dunn
Software Craftsman
http://wxPython.org
It does in 2.9, it's a new feature. I don't think I've actually tried
it however so I'm not sure if it's implemented for all platforms.
> Also, I'm surprised you could find the msgDialog by ID by searching for
> wx.OK, as I thought that was just a style flag.
Yeah, that should have been wx.ID_OK.
On Mon, Nov 7, 2011 at 1:40 PM, Robin Dunn <ro...@alldunn.com> wrote:
> On 11/7/11 11:32 AM, C M wrote:
>>
>>
>> On Mon, Nov 7, 2011 at 2:26 PM, Mike Driscoll <kyos...@gmail.com
>> <mailto:kyos...@gmail.com>> wrote:
>>
>> As I recall, we don't always have access to every widget in a
>> wx.MessageDialog because the OS itself doesn't allow it. Remember,
>> wxPython wraps the native widgets where ever possible. This may be
>> one of those cases. If so, then rolling your own wx.Dialog is the
>> way to go. It's really not that hard.
>>
>>
>> That's how I think of it, too. What I'm surprised about is that the
>> wxWidgets API shows a method, SetOKLabel(ButtonLabel), which "Overrides
>> the default label of the OK button." wxPython doesn't have this method.
>>
>
> It does in 2.9, it's a new feature. I don't think I've actually tried it
> however so I'm not sure if it's implemented for all platforms.
>
Haven't tried it on all platforms yet but it does work on Windows (wx2.9):
There appears to be a method for each possible enumeration of buttons
supported by the dialog.
SetOKCancelLabels("OK Button String", "Cancel Button string")
SetOkLabel("Ok Label String")
SetYesNoCancelLabels(...,...,...)
...
Cody