[Glade-users] glade handlers with state



I am using pygtk and glade-2.  I would like my glade handlers to have
a self variable, to store various attributes.  I started with an
example like

#!/usr/bin/env python
import gtk, gtk.glade

class GladeHandlers:
    def on_quit_clicked(event):
        gtk.mainquit()

class WidgetsWrapper:
    def __init__(self):
        self.widgets = gtk.glade.XML ('hellow1.glade')
        self.widgets.signal_autoconnect(GladeHandlers.__dict__)
    # Gives us the ability to do: widgets['widget_name'].action()
    def __getitem__(self, key):
        return self.widgets.get_widget(key)

widgets = WidgetsWrapper()
gtk.mainloop ()

Is there a analogous pattern where the handler class can have a self
variable?

Thanks,
John 






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]