I'm working on a a fairly complex GUI application: lots of screens and
dialogs and lots of data to keep track of.  My instinct is to organize
my work into files - one file for the implementation of each major ui
element.  There are a several (quite a few, actually) data structures
that are needed all over the place, so it seems natural to treat them as
globals, initialized in the main application file.  My question is the
what is the best (and most python-esque) way to do this.  Right now i'm
doing something like this


main_file.py
--------
import dialog1

datastruct1 = "foo"

dialog1.create("blah blah blah")
--------

dialog1.py
--------
from sys import modules

datastruct1 = modules["__main__"].datastruct1

def create(data):
    global datastruct1
    do_stuff(datastruct1, data)
--------

This works, but importing toplevel data through sys.modules seems so
inelegant.  Is there a better way or standard python idiom for doing
this?

Jay

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to