[Documentation] Handling signals via `do_<signal_name>` method is not documented.
In docs about signals https://pygobject.readthedocs.io/en/latest/guide/api/signals.html it is never stated that you can easily handle signals without manually connecting using special method name.
For example, this (and some other) guides state that you can implement method with name
do_<signal_name> inside a class: https://github.com/sebp/PyGObject-Tutorial/blob/master/source/objects.txt
When a new signal is created, a method handler can also be defined, it will be called each time the signal is emitted. It is called do_signal_name.
You have to name the methods like do_virtual_method:
from gi.repository import Gtk class Patch(Gtk.DrawingArea): def __init__(self): super(Patch,self).__init__() def do_get_preferred_width(self): print("test") return 100, 100 def do_get_preferred_height(self): print("test") return 100, 100 win = Gtk.Window() win.add(Patch()) win.connect('destroy', Gtk.main_quit) win.show_all() Gtk.main()
Looks like this behaviour deserves to be properly documented in official docs.