> You can always tell whether a module has been loaded already by
> looking for it in sys.modules.keys(). As for tracking the page each
> module is loaded into, that's probably something you'd be better off
> doing yourself (and as long as append_page() is used to add new pages,
> it shouldn't be particularly difficult).
Thanks,
I have sussed out how to use the notebook to keep track of which modules
are useing which page. Not quite true, but as I don't care what page
they are on - only in showing the page they are on the following seems
to work quite well...
def change_cog(newcog):
loaded = FALSE
for i in sys.modules.keys():
if i == newcog:
loaded = TRUE
for j in GearBox.children():
if j.get_name() == newcog:
GearBox.set_page(GearBox.page_num(j))
if loaded == FALSE:
try:
setcog = __import__(newcog)
ModTree = GladeXML(newcog+".glade", newcog)
cog = ModTree.get_widget(newcog)
GearBox.append_page(cog,GtkLabel(newcog))
setcog._setup()
GearBox.set_page(GearBox.page_num(cog))
except Error, msg:
print "Bogus glade file?"
Any way, is this the best? I am still getting to know both python and
the gtk widget set so any advise is welcome...
--
Rob Brown-Bayliss
---======o======---
www.ZOOstation.cc
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk