wx.MessageBox with "Don't show this warning again" checkbox

Hi,

How do you create a MessageBox or MessageDialog with a "Don't show this
warning again" checkbox? And how do you read out the status of the checkbox
once the user clicks OK?

Regards,
Frank Aune

Andrea Gavana wrote:

Hi Frank,

How do you create a MessageBox or MessageDialog with a "Don't show this
warning again" checkbox? And how do you read out the status of the checkbox
once the user clicks OK?

Simply create a subclass of wx.Dialog, add your text and checkbox,
your Ok and Cancel buttons (or whatever) and then use ShowModal() to
present the dialog to the user.
Then, when the user clicks on the Ok or Cancel button, before calling
Destroy() on the dialog, query the status of the checkbox:

answer = theDialog.ShowModal()
if answer != wx.ID_OK:
   theDialog.Destroy()
   return

userChoice = theDialog.theCheckBox.GetValue()
theDialog.Destroy()

# do whatever you want with your userChoice value

Does anyone else think this would be a great style, or Dialog mixin to have in wxPython? It seems like it is asked about a lot and I would use it if it were. I guess the dialog would just have a GetShowAgain method or something similar that you would call after it was Shown.

Any thoughts?

- Mike Rooney

ยทยทยท

On 4/27/07, Frank Aune wrote: