Using Wing with GTK and PyGObject

Wing is a Python IDE that can be used to develop, test, and
debug Python code written for GTK using PyGObject. Two versions of Wing are appropriate for use with this document:
Wing Pro is the full-featured Python IDE for professional programmers, and Wing Personal
is a free alternative with reduced feature set.

This document describes how to configure Wing for GTK and PyGObject. To get started using
Wing as your Python IDE, please refer to the tutorial in Wing's Help menu or read the
Quickstart Guide.

Auto-Completion

PyGObject uses lazy (on-demand) loading of functionality to speed up startup of
applications that are based on it. This prevents Wing's analysis engine from
inspecting PyGObject-wrapped APIs and thus the IDE fails to offer auto-completion.

To work around this, use Fakegir, which
is a tool to build a fake Python package of PyGObject modules that can be added
to the SourceAnalysis>Advanced>InterfaceFilePath in preferences.
The parent directory of the generated gi package should be added; if the
defaults are used, the directory to add is ~/.cache/fakegir.

Fakegir's README.md provides usage details.

Don't add the Fakedir produced package to the PythonPath defined in Wing's
ProjectProperties because code will not work if the fake module is
actually on sys.path when importing any PyGObject-provided modules.

Once this is done Wing should offer auto-completion for all PyGObject-provided
modules and should be able to execute and debug your code without disruption.