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

Chris Green cl at
Sun Mar 12 08:14:32 EDT 2017

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.

This question relates to how one communicates between windows/GUIs.

When the program starts theres a main GUI, class name abookgui.  If
you want to add new entries or modify existing entries an edit GUI is
started in a separate window, class abookeditgui.

I need the abookeditgui window to be able to tell the parent abookgui
window that it has completed whatever it was doing.  It has two basic
possibilities 'Cancel', i.e. nothing was changed or 'Save' meaning
there's a new/changed item in the database.  The parent abookgui needs
to know when one of these has happened.

What's the 'right' way to do this?  I can see several non-event driven
ways of doing it badly but I'm not sure of the proper event driven
way.   The parent abookgui only has the name of the abookeditgui
object, it can of course access the abookeditgui instance variables so
it can hook (for example) a window exit event (I think!).

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?

Chris Green

More information about the Python-list mailing list