Google Groups Home
Help | Sign in
Message from discussion wxpython dialog - do something after ShowModal()?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Iain King  
View profile
 More options May 13, 10:06 am
Newsgroups: comp.lang.python
From: Iain King <iaink...@gmail.com>
Date: Tue, 13 May 2008 07:06:07 -0700 (PDT)
Local: Tues, May 13 2008 10:06 am
Subject: Re: wxpython dialog - do something after ShowModal()?
On May 13, 2:43 pm, Iain King <iaink...@gmail.com> wrote:

> On May 13, 2:20 pm, Larry Bates <larry.ba...@websafe.com`> 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

After having a hunt through the wxpython mailing list archives I found
the answer:  the event is EVT_INIT_DIALOG:

dlg.Bind(wx.EVT_INIT_DIALOG, onInit, dlg)

work.  Thanks for the pointer.

Iain


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google