Construct class from superclass instance
问题 So you have some function, say Gtk.Builder.get_object() , which returns some widget. In our case a Gtk.Window() . I have a subclass of Gtk.Window() which adds some signal handlers. class Window(Gtk.Window): Is it possible to use the widget returned by Gtk.Builder.get_object() to construct Window() ? I think it should be using __new__() or something, but I can't figure it out. 回答1: I think using __new__ is exactly what you want to be doing. If you can set the __class__ attribute of the