I have a pygtk application and would like to provide a text-based fallback mode for it. When mporting gtk without a X display available I see only a GtkWarning on stderr but no exception I could take advantage of and checking for DISPLAY seems like an ugly hack. How can I implement this?
Checking gtk.gdk.screen_get_default() does it, however there seems no way to suppress the GTK warnings.
Implementing a text-based fallback for pygtk applications