That’s a GTK2 tutorial; it’s really useless.
If you want to read the API reference, there’s a site for GTK4: https://amolenaar.github.io/pgi-docgen/#Gtk-4.0/classes/MessageDialog.html#Gtk.MessageDialog
You still haven’t answered my question: why are you fixating on the MessageDialog class? What are you trying to achieve?