Python 将用户_数据传递到Gtk.Builder.connect_信号中的回调类

Python 将用户_数据传递到Gtk.Builder.connect_信号中的回调类,python,python-3.x,gtk3,pygobject,Python,Python 3.x,Gtk3,Pygobject,如何将用户_数据传递给在分离类中定义的回调。考虑: from gi.repository import Gtk class CallBacks(object): def onQuit(self, widget, app): pass class App(Gtk.Application): def __init__(self): super().__init__(application_id="org.stof.example")

如何将用户_数据传递给在分离类中定义的回调。考虑:

from gi.repository import Gtk

class CallBacks(object):
    def onQuit(self, widget, app):
        pass

class App(Gtk.Application):
    def __init__(self):
        super().__init__(application_id="org.stof.example")

        callbacks = CallBacks()

        self.builder = Gtk.Builder.new_from_file("example.ui")
        self.builder.connect_signals(callbacks)

        self.register()

如何将应用程序实例传递给回调函数?类似于self.builder.connect\u signalscallbacks,self

我不知道这是否可行,而且现在时间不是我的朋友,所以我已经做了一个变通方法,那就是在回调构造函数中传递应用程序实例

callbacks=callbackself

def uu init u self,app:on CallBacks类