Does one create an event to notify parent window/GUI of something?

Chris Green cl at isbd.net
Sun Mar 12 11:05:20 EDT 2017


Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Sun, 12 Mar 2017 12:14:32 +0000, Chris Green <cl at isbd.net> declaimed the
> following:
> 
> >This is a rather a beginner question.  I'm heavily modifying some code
> >that was an LDAP address book to be a sqlite3 based address book.  I
> >have the basic GUI working and I'm now getting the database
> >connections to work.
> >
>         <snip>
> 
> >
> >There are (of course) event handlers for the 'Save' and 'Cancel'
> >button click events in abookeditgui, what I need is hooks from these
> >to run some code in abookgui after the abookeditgui has completed. How
> >should one do this, is there a way for a class to call code in the
> >class 'above' which instantiated it?
> >
> 
>         1)      You fail to mention just which toolkit you are using -- things may
> differ between wx, Tk, or any of the other toolkits (or meta-toolkits --
> Dabo is built on top of one of the other basic toolkits). (And, knowing my
> luck, my decade old WxPython book is out-of-date as Wx updates are a new
> architecture)
> 
I'm using Python GTK, sorry I should have included this information.


>         2)      It sounds a bit like your edit window needs to be a modal window,
> blocking the main window from responding to anything until the edit window
> completes. In my Wx book, dialogs can be displayed using .showModal() --
> which blocks the parent window at that point. When the dialog goes away,
> the return code (OK/Cancel) is provided as the result of the .showModal()
> call, and the main code can now act upon it.

That might well be one way of doing it, thanks.

However I find modal windows *very* annoying at times so I'd prefer
not to do it this way.  The annoyance here would be (for example)
needing to look up something elsewhere in the address book to fill in
something on the new address, a modal edit box would prevent this.

The logic of what you suggest is perfect, I want something to happen
in the main code when the edit GUI window exits.

-- 
Chris Green
·


More information about the Python-list mailing list