Google Groups Home
Help | Sign in
wxpython dialog - do something after ShowModal()?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all
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, 8:41 am
Newsgroups: comp.lang.python
From: Iain King <iaink...@gmail.com>
Date: Tue, 13 May 2008 05:41:25 -0700 (PDT)
Local: Tues, May 13 2008 8:41 am
Subject: wxpython dialog - do something after ShowModal()?
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


    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.
Larry Bates  
View profile
 More options May 13, 9:20 am
Newsgroups: comp.lang.python
From: Larry Bates <larry.ba...@websafe.com`>
Date: Tue, 13 May 2008 08:20:15 -0500
Local: Tues, May 13 2008 9:20 am
Subject: Re: wxpython dialog - do something after ShowModal()?

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


    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.
Iain King  
View profile
 More options May 13, 9:43 am
Newsgroups: comp.lang.python
From: Iain King <iaink...@gmail.com>
Date: Tue, 13 May 2008 06:43:13 -0700 (PDT)
Local: Tues, May 13 2008 9:43 am
Subject: Re: wxpython dialog - do something after ShowModal()?
On May 13, 2:20 pm, Larry Bates <larry.ba...@websafe.com`> wrote:

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


    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.
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:

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.
Gabriel Genellina  
View profile
 More options May 13, 11:49 pm
Newsgroups: comp.lang.python
From: "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
Date: Wed, 14 May 2008 00:49:47 -0300
Local: Tues, May 13 2008 11:49 pm
Subject: Re: wxpython dialog - do something after ShowModal()?
En Tue, 13 May 2008 09:41:25 -0300, Iain King <iaink...@gmail.com>  
escribió:

> 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.

I've seen you already answered your question. But are you sure that doing  
this is a good thing? If you try to be too clever or too helpful the  
interfase may become annoying at some times. You can't guess the user's  
intention or read his mind.
By example, what if I already have the desired file name copied in the  
clipboard? I don't want the file selector to pop up.

I completely *hate* Windows programs with a "Browse for folder" button  
that don't let me paste a name, neither start opened at the currently  
selected folder.

--
Gabriel Genellina


    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.
David C. Ullrich  
View profile
 More options May 14, 4:37 pm
Newsgroups: comp.lang.python
From: "David C. Ullrich" <dullr...@sprynet.com>
Date: Wed, 14 May 2008 15:37:50 -0500
Local: Wed, May 14 2008 4:37 pm
Subject: Re: wxpython dialog - do something after ShowModal()?
In article
<a14c2400-e88b-4d90-80bb-a5fe27fed...@m44g2000hsc.googlegroups.com>,
 Iain King <iaink...@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.


    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.
Iain King  
View profile
 More options May 15, 4:19 am
Newsgroups: comp.lang.python
From: Iain King <iaink...@gmail.com>
Date: Thu, 15 May 2008 01:19:45 -0700 (PDT)
Local: Thurs, May 15 2008 4:19 am
Subject: Re: wxpython dialog - do something after ShowModal()?
On May 14, 9:37 pm, "David C. Ullrich" <dullr...@sprynet.com> wrote:

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.

    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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