Who's to blame?

Nicola Musatti nicola.musatti at gmail.com
Fri Jan 4 04:35:25 EST 2008


Hallo, Mike.
First of all, thanks to both you and Rob for your answers. I now see
that the wxPython group would have been a better place to post to, all
the more so given the tight connection between the wxPython and
wxWidgets projects, of which at first I wasn't aware.

On Jan 3, 8:19 pm, kyoso... at gmail.com wrote:
[...]
> I've never created a modal dialog like this. Instead, I follow the
> wxPython in Action book examples (most of the time), which would do a
> yes/no dialog like this:
>
> <code>
>
> dlg = wx.MessageDialog(None, 'Some Message', 'A Message Box',
> wx.YES_NO | wx.QUESTION)
> retCode = dlg.ShowModal()
> if retCode == wx.ID_YES:
>    # do something
>    print 'yes'
> else:
>    # do something else
>    print 'no'
> dlg.Destroy()
>
> </code>

Actually my example started out as something like

if wx.MessageBox(message="Some message", caption="Some caption",
        style=wx.YES|wx.NO) == wx.YES:
    pass

I had to change it because the actual message can become very long, so
I assembled a dialog with a scrollable text field. Maybe I'm expecting
to much of wxStdDialogButtonSizer, but I still feel that given that
both your method and mine above work straight away, it should provide
the same behaviour with Yes/No buttons as with OK/Cancel ones.

Cheers,
Nicola Musatti



More information about the Python-list mailing list