GTK includes an interactive debugger, called the GTK Inspector, which lets you explore the widget tree of any GTK application at runtime, as well as tweak the theme and trigger visual debugging aids. You can easily try out changes at runtime before putting them into the code.
Note that the GTK inspector can only show GTK internals. It can not understand the application-specific logic of a GTK application. Also, the fact that the GTK inspector is running in the application process limits what it can do. It is meant as a complement to full-blown debuggers and system tracing facilities such as DTrace, not as a replacement.
To enable the GTK inspector, you can use the Control-Shift-I or
Control-Shift-D keyboard shortcuts, or set the
GTK_DEBUG=interactive
environment variable.
There are a few more environment variables that can be set to
influence how the inspector renders its UI.
GTK_INSPECTOR_DISPLAY
and
GTK_INSPECTOR_RENDERER
determine the GDK
display and the GSK renderer that the inspector is using.
In some situations, it may be inappropriate to give users access
to the GTK inspector. The keyboard shortcuts can be disabled with
the enable-inspector-keybinding
key in the
org.gtk.Settings.Debug
GSettings schema.