yes no messagedialog with 'safety feature'?

I'd like to create a dialog to allow a user to OK the permanent
deletion of stuff, and as such I'd like to build in an extra layer of
safety beyond just "Are you sure? Click Yes or No" in case of
confusion, wild mouse click, temporary insanity, etc... I've seen some
applications where one is required to type "yes" into a text field in
order to have it go through. I thought this might be a good idea.
(Opinions welcome as to whether it is or isn't; in this use case,
presumably the users would very rarely need to use this deletion
function, so it wouldn't be onerous to now and then type "yes").

I'd also like it to look native and have a native warning symbol. I
can create a dialog, but I don't know how to get a warning symbol onto
a custom dialog the way I would automatically with a
wx.MesssageDialog. Or how best to use the various convenience
functions to lay out buttons easily; for example, if I use
self.CreateStdDialogButtonSizer(wx.YES | wx.NO) as the only action on
a blank dialog, it puts it at the very top and only displays the Yes
button.

I could just do the layout all myself as with any panel, but I would
miss out on the native warning icon and also thought I might be
missing the point of the conveniences of using the dialog class, even
when customizing it. Guidance appreciated.

Thanks,
Che

Hi Che,

···

On Aug 5, 11:09 pm, C M <cmpyt...@gmail.com> wrote:

I'd like to create a dialog to allow a user to OK the permanent
deletion of stuff, and as such I'd like to build in an extra layer of
safety beyond just "Are you sure? Click Yes or No" in case of
confusion, wild mouse click, temporary insanity, etc... I've seen some
applications where one is required to type "yes" into a text field in
order to have it go through. I thought this might be a good idea.
(Opinions welcome as to whether it is or isn't; in this use case,
presumably the users would very rarely need to use this deletion
function, so it wouldn't be onerous to now and then type "yes").

I'd also like it to look native and have a native warning symbol. I
can create a dialog, but I don't know how to get a warning symbol onto
a custom dialog the way I would automatically with a
wx.MesssageDialog. Or how best to use the various convenience
functions to lay out buttons easily; for example, if I use
self.CreateStdDialogButtonSizer(wx.YES | wx.NO) as the only action on
a blank dialog, it puts it at the very top and only displays the Yes
button.

I could just do the layout all myself as with any panel, but I would
miss out on the native warning icon and also thought I might be
missing the point of the conveniences of using the dialog class, even
when customizing it. Guidance appreciated.

Thanks,
Che

You should be able to use the wx.ArtProvider for that. Here's a simple
example to get an Information icon:

<code>

import wx

########################################################################
class MyDialog(wx.Dialog):
    """"""

#----------------------------------------------------------------------
    def __init__(self):
        """Constructor"""
        wx.Dialog.__init__(self, None, wx.ID_ANY, 'Dialog Tutorial')
        bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
wx.ART_CMN_DIALOG, (24,24))
        imgCtrl = wx.StaticBitmap(self, wx.ID_ANY, bmp)

if __name__ == "__main__":
    app = wx.App(False)
    dlg = MyDialog()
    dlg.ShowModal()
    dlg.Destroy()

</code>

Hope that helps!

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

Blog: http://blog.pythonlibrary.org

Hi Che,

···

On 6 August 2010 14:45, Mike Driscoll <kyosohma@gmail.com> wrote:

Hi Che,

On Aug 5, 11:09 pm, C M <cmpyt...@gmail.com> wrote:

I'd like to create a dialog to allow a user to OK the permanent
deletion of stuff, and as such I'd like to build in an extra layer of
safety beyond just "Are you sure? Click Yes or No" in case of
confusion, wild mouse click, temporary insanity, etc... I've seen some
applications where one is required to type "yes" into a text field in
order to have it go through. I thought this might be a good idea.
(Opinions welcome as to whether it is or isn't; in this use case,
presumably the users would very rarely need to use this deletion
function, so it wouldn't be onerous to now and then type "yes").

I'd also like it to look native and have a native warning symbol. I
can create a dialog, but I don't know how to get a warning symbol onto
a custom dialog the way I would automatically with a
wx.MesssageDialog. Or how best to use the various convenience
functions to lay out buttons easily; for example, if I use
self.CreateStdDialogButtonSizer(wx.YES | wx.NO) as the only action on
a blank dialog, it puts it at the very top and only displays the Yes
button.

I could just do the layout all myself as with any panel, but I would
miss out on the native warning icon and also thought I might be
missing the point of the conveniences of using the dialog class, even
when customizing it. Guidance appreciated.

Thanks,
Che

You should be able to use the wx.ArtProvider for that. Here's a simple
example to get an Information icon:

<code>

import wx

########################################################################
class MyDialog(wx.Dialog):
""""""

#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Dialog.__init__(self, None, wx.ID_ANY, 'Dialog Tutorial')
bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
wx.ART_CMN_DIALOG, (24,24))
imgCtrl = wx.StaticBitmap(self, wx.ID_ANY, bmp)

if __name__ == "__main__":
app = wx.App(False)
dlg = MyDialog()
dlg.ShowModal()
dlg.Destroy()

</code>

Hope that helps!

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

Blog: http://blog.pythonlibrary.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

You might like to see what I've done with Whyteboard's save dialog:

http://bazaar.launchpad.net/~sproaty/whyteboard/development/annotate/head%3A/whyteboard/gui/dialogs.py#L649

http://img706.imageshack.us/img706/8130/screenshot8up.png

It basically relies on a few variables from the "misc.util" module,
but the dialog is mostly independent.

Hi Che,

I think the dialog Steven showed is an excellent solution to your problem. I've done both programming and office IT management (where I saw people click "ok" when it warned them about deleting critical system files), and I can tell you that the problem you're trying to avoid is caused by having "yes" and "no" or "ok" and "cancel" buttons for everything from the most trivial informative dialog to the most serious dialog which warns of data loss. People cannot, at a glance, distinguish between the two, and they assume they're all just "informative" dialogs, which they find annoying and try to get rid of quickly. In this way, people get conditioned to click "ok" or "yes" without reading because so many of these dialogs really say things that the average user either doesn't understand or doesn't care about.

However, using descriptive button titles that are not the 'standard' ones causes the user to stop and pause for a second to at least read the button title. A user typically is not going to click on "Don't Save" or "Delete" without thinking "wait, what, don't save / delete what?". At that point, they'll actually stop to read the descriptive text on the dialog. :wink: On Mac, Apple strongly encourages the use of descriptive button titles, and also encourages app developers to avoid dialogs for informative messages that don't require user feedback, and I can tell you it prevents a lot of these mistaken clicks.

Regards,

Kevin

···

On Aug 5, 2010, at 9:09 PM, C M wrote:

I'd like to create a dialog to allow a user to OK the permanent
deletion of stuff, and as such I'd like to build in an extra layer of
safety beyond just "Are you sure? Click Yes or No" in case of
confusion, wild mouse click, temporary insanity, etc... I've seen some
applications where one is required to type "yes" into a text field in
order to have it go through. I thought this might be a good idea.
(Opinions welcome as to whether it is or isn't; in this use case,
presumably the users would very rarely need to use this deletion
function, so it wouldn't be onerous to now and then type "yes").

I'd also like it to look native and have a native warning symbol. I
can create a dialog, but I don't know how to get a warning symbol onto
a custom dialog the way I would automatically with a
wx.MesssageDialog. Or how best to use the various convenience
functions to lay out buttons easily; for example, if I use
self.CreateStdDialogButtonSizer(wx.YES | wx.NO) as the only action on
a blank dialog, it puts it at the very top and only displays the Yes
button.

I could just do the layout all myself as with any panel, but I would
miss out on the native warning icon and also thought I might be
missing the point of the conveniences of using the dialog class, even
when customizing it. Guidance appreciated.

Thanks,
Che

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Thanks, Mike. That's great to know. I had heard ArtProvider
mentioned but never had occasion to use it yet. By the way, at least
on my system, if I set the size of the staticBitmap to (24,24) as you
have it, it looks jaggy. Only if I set the size to (32,32) does it
look right/smooth. Even (-1,-1) doesn't look right. But (32,32) is
the size I'd like anyway, so that's fine.

Che

···

On Fri, Aug 6, 2010 at 9:45 AM, Mike Driscoll <kyosohma@gmail.com> wrote:

Hi Che,

On Aug 5, 11:09 pm, C M <cmpyt...@gmail.com> wrote:

I'd like to create a dialog to allow a user to OK the permanent
deletion of stuff, and as such I'd like to build in an extra layer of
safety beyond just "Are you sure? Click Yes or No" in case of
confusion, wild mouse click, temporary insanity, etc... I've seen some
applications where one is required to type "yes" into a text field in
order to have it go through. I thought this might be a good idea.
(Opinions welcome as to whether it is or isn't; in this use case,
presumably the users would very rarely need to use this deletion
function, so it wouldn't be onerous to now and then type "yes").

I'd also like it to look native and have a native warning symbol. I
can create a dialog, but I don't know how to get a warning symbol onto
a custom dialog the way I would automatically with a
wx.MesssageDialog. Or how best to use the various convenience
functions to lay out buttons easily; for example, if I use
self.CreateStdDialogButtonSizer(wx.YES | wx.NO) as the only action on
a blank dialog, it puts it at the very top and only displays the Yes
button.

I could just do the layout all myself as with any panel, but I would
miss out on the native warning icon and also thought I might be
missing the point of the conveniences of using the dialog class, even
when customizing it. Guidance appreciated.

Thanks,
Che

You should be able to use the wx.ArtProvider for that.

Good points, Kevin, and thanks also to Steven for that example from
Whyteboard. I think I will implement buttons that have "Delete?" and
"Don't Delete" or something in that vein and possibly the confirm
"yes" text as well (again, it should be rare that a user will want to
delete in my case, but if so I want them to be quite sure about it).

Kevin, if dialogs are discouraged, what does Apple suggest developers
do for providing informative messages that don't require user action?
I think some feedback to the user when things happen correctly is good
and reassuring for use, but I agree that having to click "OK" each
time is a hassle and as you said leads to users tuning out all
dialogs. Maybe just a briefly fading-out popup window or something?

Che

···

On Fri, Aug 6, 2010 at 11:55 AM, Kevin Ollivier <kevin-lists@theolliviers.com> wrote:

Hi Che,

I think the dialog Steven showed is an excellent solution to your problem. I've done both programming and office IT management (where I saw people click "ok" when it warned them about deleting critical system files), and I can tell you that the problem you're trying to avoid is caused by having "yes" and "no" or "ok" and "cancel" buttons for everything from the most trivial informative dialog to the most serious dialog which warns of data loss. People cannot, at a glance, distinguish between the two, and they assume they're all just "informative" dialogs, which they find annoying and try to get rid of quickly. In this way, people get conditioned to click "ok" or "yes" without reading because so many of these dialogs really say things that the average user either doesn't understand or doesn't care about.

However, using descriptive button titles that are not the 'standard' ones causes the user to stop and pause for a second to at least read the button title. A user typically is not going to click on "Don't Save" or "Delete" without thinking "wait, what, don't save / delete what?". At that point, they'll actually stop to read the descriptive text on the dialog. :wink: On Mac, Apple strongly encourages the use of descriptive button titles, and also encourages app developers to avoid dialogs for informative messages that don't require user feedback, and I can tell you it prevents a lot of these mistaken clicks

you probably already have figured out how to check for yes in the
TextCtrl, but here is a partial idea of how to do it:

##this goes in the dialog __init__()
self.text_ctrl= wx.TextCtrl()#put whatever arguments you need in there
self.del_button=wx.Button()#This button should say 'Delete'
self.del_button.Bind(wx.EVT_BUTTON,self.OnDelete)
##this code is an event handler it goes out side __init__() but inside
dialog class
def OnDelete(self, evt):
    text=self.text_ctrl.GetText()
    if text == 'yes':
        self.Close()
    else:
       return

Hi Che,

Hi Che,

I think the dialog Steven showed is an excellent solution to your problem. I've done both programming and office IT management (where I saw people click "ok" when it warned them about deleting critical system files), and I can tell you that the problem you're trying to avoid is caused by having "yes" and "no" or "ok" and "cancel" buttons for everything from the most trivial informative dialog to the most serious dialog which warns of data loss. People cannot, at a glance, distinguish between the two, and they assume they're all just "informative" dialogs, which they find annoying and try to get rid of quickly. In this way, people get conditioned to click "ok" or "yes" without reading because so many of these dialogs really say things that the average user either doesn't understand or doesn't care about.

However, using descriptive button titles that are not the 'standard' ones causes the user to stop and pause for a second to at least read the button title. A user typically is not going to click on "Don't Save" or "Delete" without thinking "wait, what, don't save / delete what?". At that point, they'll actually stop to read the descriptive text on the dialog. :wink: On Mac, Apple strongly encourages the use of descriptive button titles, and also encourages app developers to avoid dialogs for informative messages that don't require user feedback, and I can tell you it prevents a lot of these mistaken clicks

Good points, Kevin, and thanks also to Steven for that example from
Whyteboard. I think I will implement buttons that have "Delete?" and
"Don't Delete" or something in that vein and possibly the confirm
"yes" text as well (again, it should be rare that a user will want to
delete in my case, but if so I want them to be quite sure about it).

Kevin, if dialogs are discouraged, what does Apple suggest developers
do for providing informative messages that don't require user action?
I think some feedback to the user when things happen correctly is good
and reassuring for use, but I agree that having to click "OK" each
time is a hassle and as you said leads to users tuning out all
dialogs. Maybe just a briefly fading-out popup window or something?

Well, it depends on what you mean by "when things happen correctly". Unless there's some reason for the user to doubt an operation was successful (perhaps a long-running task not showing any progress updates?), the user will assume it was successful. If the app is giving them a reason not to assume that, then that I think the reason for that needs to be determined and addressed directly.

As for things like notifications, or feedback on long-running tasks, often toasts are used for this sort of UI. Or, use the window's status bar and/or have some slide-in panel somewhere on the window with the message and have the user either close it when they want, or just have it disappear after a given time.

Regards,

Kevin

···

On Aug 6, 2010, at 10:27 AM, C M wrote:

On Fri, Aug 6, 2010 at 11:55 AM, Kevin Ollivier > <kevin-lists@theolliviers.com> wrote:

Che

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Thanks. Yep, that's about what I am doing. Just for the archive's
sake, the method is .GetValue(), though. I'm also doing text.lower()
so that if they type "Yes", "yes", or "YES" it will all go through.

Che

···

On Fri, Aug 6, 2010 at 2:49 PM, mpnordland <mpnordland@gmail.com> wrote:

you probably already have figured out how to check for yes in the
TextCtrl, but here is a partial idea of how to do it:

##this goes in the dialog __init__()
self.text_ctrl= wx.TextCtrl()#put whatever arguments you need in there
self.del_button=wx.Button()#This button should say 'Delete'
self.del_button.Bind(wx.EVT_BUTTON,self.OnDelete)
##this code is an event handler it goes out side __init__() but inside
dialog class
def OnDelete(self, evt):
text=self.text_ctrl.GetText()
if text == 'yes':
self.Close()
else:
return

Well, it depends on what you mean by "when things happen correctly". Unless there's some reason for the user to doubt an operation was successful (perhaps a long-running task not showing any progress updates?), the user will assume it was successful. If the app is giving them a reason not to assume that, then that I think the reason for that needs to be determined and addressed directly.

As for things like notifications, or feedback on long-running tasks, often toasts are used for this sort of UI. Or, use the window's status bar and/or have some slide-in panel somewhere on the window with the message and have the user either close it when they want, or just have it disappear after a given time.

That does sound like a more elegant user experience, and I think I
will begin changing things to be more after that fashion. Thanks,
Kevin.

Che