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.
If you do not already have Wing installed, download it now.
To get started using Wing, refer to the tutorial in the Help menu in Wing or the Quickstart Guide.
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 Source Analysis > Advanced > Interface File Path 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 Python Path defined in Wing's Project Properties 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.
Wing provides many other options and tools. For more information: