wxpython dialog - do something after ShowModal()?

Larry Bates larry.bates at websafe.com`
Tue May 13 09:20:15 EDT 2008


Iain King 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?
> 
> Iain

If the only things on your modal dialog are Browse and cancel, just call the 
wx.FileDialog directly and eliminate the intermediate modal dialog.  If not 
don't bind the FileDialog to a button, just create an instance of it as the last 
  you do in the __init__ method of the modal dialog code.

If this doesn't help, you will have better luck posting to wxpython newsgroup.

-Larry



More information about the Python-list mailing list