On May 13, 2:20 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > 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
The dialog doesn't only let you call the file dialog, it does other stuff too. Your suggestion of __init__ sounded promising, but neither giving the dialog an __init__() method nor an OnInit() method worked. Thanks anyway. Iain -- http://mail.python.org/mailman/listinfo/python-list