wxpython dialog - do something after ShowModal()?

Iain King iainking at gmail.com
Thu May 15 04:19:45 EDT 2008


On May 14, 9:37 pm, "David C. Ullrich" <dullr... at sprynet.com> wrote:
> In article
> <a14c2400-e88b-4d90-80bb-a5fe27fed... at m44g2000hsc.googlegroups.com>,
>  Iain King <iaink... at gmail.com> wrote:
>
> > Hi.  I have a modal dialog whcih has a "Browse..." button which pops
> > up a file selector.  This all works fine, but the first thing the user
> > has to do when they open the dialog is select a file, so I would like
> > the dialog to automatically call the onBrowse function as soon as the
> > dialog opens.  However, I don't know how to do this.
>
> > dlg.ShowModal()
> > onBrowse()
>
> > obviously doesn't work, and neither does the reverse.  I was hoping
> > that the dialog would throw some kind of "I have been shown" event,
> > but it doesn't (as far as I can tell).  How do I make the dialog do
> > something as soon as it's been shown?
>
> It's too bad that you found an answer. You _shouldn't_ have your
> dialog pop up a file-selection box as soon as it's shown! That's
> not the way dialogs usually work, so you're going to confuse
> people.
>
> Instead, first pop up the file-selection box, and then pop up
> the dialog (without the Browse button) to do whatever else it
> does after you've got the filename.
>

That's actually what happens - the dialog throws EVT_INIT_DIALOG
before it displays itself.  Not that I really agree with you.  I don't
think that a "do such-and-such dialog" appearing with a "Select file
for such-and-such" file selector on top of it, the file selector being
in focus, is confusing for the user.  Actually, I think it'd be
friendlier - the user can see where the data from the file is going,
so has an immediate reminder of what the (generic) file selector is
for.



More information about the Python-list mailing list