[...]
>       That is in fact quite useful, and I've managed to figure out how to adjust my 
>handling of the various widgets, except for when I want to hide the window, which
[...]
>       My understanding of what's happening here is admittedly shaky, but I am under 
>the impression that "self.widget.<name>" only works for widgets/components which
> are stored within the "parent" application window. How can I access the window 
>widget, which is stored in the other tree?

You're trying to use the same WidgetStore for the main window *and* the
dialogue box.

What you need to do is:

def on_button(self, obj):
        if obj.get_active():
                self.dialogue = self.readglade("game_informtion_editor")
                self.dialoguewidget = WidgetStore(self.dialogue)
        else:
                self.dialoguewidget.game_information_editor.hide()

So now, self.widget refers to the main window's widget tree, and
self.dialoguewidget refers to the dialogue box's widget tree.

In general, you need a seperate WidgetStore object for every Glade object that
appears in the top-level window. (Usually windows.) I haven't tried it on
pop-ups.

The way I do dialogue boxes is to implement each one as a seperate class...

class Application:
        def __init__(self):
                self.window = self.readglade("mainwindow")
                self.widget = WidgetStore(self.window)

        def on_button(self, obj):
                Dialogue(self)

class Dialogue:
        def __init__(self, app):
                self.window = app.readglade("dialoguebox")
                self.widget = WidgetStore(self.window)

        def on_close(self, obj):
                self.widget.dialogue.hide()
                self.widget.dialogue.destroy()

This keeps the code for each window well seperated. However, I'm not sure what
this does to the reference counter. I'm certainly noticing that SQmaiL leaks
like a sieve at times. When would the dialogue above be destroy?

-- 
+- David Given ---------------McQ-+ 
|  Work: [EMAIL PROTECTED]         | Quidquid latine dictum sit, altum viditur.
|  Play: [EMAIL PROTECTED]         | 
+- http://wired.st-and.ac.uk/~dg -+ 


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

Reply via email to