Windows
The easiest way to install GTK3 for Python is by using PyGObject for Windows. It offers an installer that installs most things you need to develop GTK appilcations.
The number of options the PyGObject installer offers can be daunting, but for most GTK projects the only option you have to select is GTK+ 3.xx
.
The C++ binding for Gtk+ is known as gtkmm.
Windows
On Microsoft Windows gtkmm can be installed through MSYS2 environment. Once MSYS2 environment is set up by installing the installer and updating the package list, install gtkmm with
pacman -S mingw-w64-x86_64-gtkmm3 #64 bit
pacman -S mingw-w64-i686-gtkmm3 #32 bit
Install pkg-config for easily obtaining compiler and linker flags and GNU autotools build integration
pacman -S pkg-config
Now gtkmm application can be compiled, linked and run from within MSYS2 environment.
# enable C++ 14 support if needed
# -mwindows flag is to suppress the background command-prompt window
# for GUI applications
g++ -mwindows -std=c++14 -o app.exe app.cpp `pkg-config --cflags --libs gtkmm-3.0`
./app.exe
But the executable won't run outside the MSYS2 shell because of missing standard environment variables for .dll lookup. The following .dlls need to be copied from <MSYS2 INSTALLATION DIRECTORY>\mingw64\lib\
(for 64-bit installation) into the application directory (where the .exe
is located) manually. The version numbers may change according to the installation.
libatk-1.0-0.dll
libatkmm-1.6-1.dll
libbz2-1.dll
libcairo-2.dll
libcairo-gobject-2.dll
libcairomm-1.0-1.dll
libepoxy-0.dll
libexpat-1.dll
libffi-6.dll
libfontconfig-1.dll
libfreetype-6.dll
libgcc_s_seh-1.dll
libgdk_pixbuf-2.0-0.dll
libgdk-3-0.dll
libgdkmm-3.0-1.dll
libgio-2.0-0.dll
libgiomm-2.4-1.dll
libglib-2.0-0.dll
libglibmm-2.4-1.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgtk-3-0.dll
libgtkmm-3.0-1.dll
libharfbuzz-0.dll
libiconv-2.dll
libintl-8.dll
libpango-1.0-0.dll
libpangocairo-1.0-0.dll
libpangoft2-1.0-0.dll
libpangomm-1.4-1.dll
libpangowin32-1.0-0.dll
libpixman-1-0.dll
libpng16-16.dll
libsigc-2.0-0.dll
libstdc++-6.dll
libwinpthread-1.dll
zlib1.dll
After this step the program should run. But it won't find standard icon sets for Gtk+, i.e. the Adwaita icon theme, so icons may not load. The icons and a few other files need to be copied into application directory so that the application can load them.
From <MSYS2 INSTALL DIRECTORY>
mingw64
|
+-- lib
|
+-- gdk-pixbuf-2.0
share
|
+-- icons
|
+-- Adwaita
|
+-- hicolor (fallback icon theme for Gtk+)
To application directory, with same directory structure.