wxpython dialog - do something after ShowModal()?

David C. Ullrich dullrich at sprynet.com
Wed May 14 16:37:50 EDT 2008


In article 
<a14c2400-e88b-4d90-80bb-a5fe27fedea3 at m44g2000hsc.googlegroups.com>,
 Iain King <iainking 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.

> Iain



More information about the Python-list mailing list