Install Gtk For Mac

To get things started we will try to run a very simple GTK based GUI application using the PyGObject providedPython bindings. First create a small Python script called hello.py withthe following content and save it somewhere:

  1. Gtk Mac Bundle Install
  2. Mac Gtk Theme
  1. Download Transmission The current release version is. Mac OS X Nightly builds Previous Releases. Source Code Nightly tarballs Previous tarballs How to build. Windows (early preview) Nightly builds. SHA256 Hashes Code Signing Policy Windows MSI packages: free code signing provided by SignPath.io, certificate by SignPath Foundation.
  2. Yes, the mac stuff is buried pretty deeply in Gtk+, so if you build PyGtk from this project then the mac stuff comes along for the ride, except for ige-mac-integration, which must be built twice. The first time it's build automatically; the second, after PyGtk is built, it must.

Before we can run the example application we need to install PyGObject, GTKand their dependencies. Follow the instructions for your platform below.

UbuntuFedoraArch Linux
WindowsmacOSopenSUSE

Yosemite Gtk Theme is one of the best MacOS Theme for Ubuntu available out there for Ubuntu and other Linux derivatives. Yosemite Gtk Theme is a Mac OSX like a theme for GTK 3, GTK 2 and Gnome-Shell which supports GTK 3 and GTK 2 based desktop environments like.

After running the example application have a look at the “Python GTK 3Tutorial” for more exampleson how to create GTK apps and the “PyGObject API Reference” for API documentation for all supportedlibraries.

Gtk

Windows¶

  1. Go to http://www.msys2.org/ and download the x86_64 installer
  2. Follow the instructions on the page for setting up the basic environment
  3. Run C:msys64mingw64.exe - a terminal window should pop up
  4. Execute pacman-Suy
  5. Execute pacman-Smingw-w64-x86_64-gtk3mingw-w64-x86_64-python3mingw-w64-x86_64-python3-gobject
  6. To test that GTK 3 is working you can run gtk3-demo
  7. Copy the hello.py script you created to C:msys64home<username>
  8. In the mingw32 terminal execute python3hello.py - a window should appear.

Ubuntu / Debian¶

Installing the system provided PyGObject:
Mojave
  1. Open a terminal
  2. Execute sudoaptinstallpython3-gipython3-gi-cairogir1.2-gtk-3.0
  3. Change the directory to where your hello.py script can be found (e.g. cdDesktop)
  4. Run python3hello.py
Installing from PyPI with pip:
  1. Open a terminal and enter your virtual environment
  2. Execute sudoaptinstalllibgirepository1.0-devgcclibcairo2-devpkg-configpython3-devgir1.2-gtk-3.0to install the build dependencies and GTK
  3. Execute pip3installpycairo to build and install Pycairo
  4. Execute pip3installPyGObject to build and install PyGObject
  5. Change the working directory to where your hello.py script can be found
  6. Run python3hello.py

Fedora¶

Installing the system provided PyGObject:
  1. Open a terminal
  2. Execute sudodnfinstallpython3-gobjectgtk3
  3. Change the working directory to where your hello.py script can be found
  4. Run python3hello.py
Installing from PyPI with pip:
  1. Open a terminal and enter your virtual environment
  2. Execute sudodnfinstallgccgobject-introspection-develcairo-develpkg-configpython3-develgtk3to install the build dependencies and GTK
  3. Execute pip3installpycairo to build and install Pycairo
  4. Execute pip3installPyGObject to build and install PyGObject
  5. Change the working directory to where your hello.py script can be found
  6. Run python3hello.py

Arch Linux¶

Installing the system provided PyGObject:
  1. Open a terminal
  2. Execute sudopacman-Spython-gobjectgtk3
  3. Change the working directory to where your hello.py script can be found
  4. Run python3hello.py
Installing from PyPI with pip:
  1. Open a terminal and enter your virtual environment
  2. Execute sudopacman-Spythoncairopkgconfgobject-introspectiongtk3to install the build dependencies and GTK
  3. Execute pip3installpycairo to build and install Pycairo
  4. Execute pip3installPyGObject to build and install PyGObject
  5. Change the working directory to where your hello.py script can be found
  6. Run python3hello.py
Gtk

openSUSE¶

Installing the system provided PyGObject:
Mac
  1. Open a terminal
  2. Execute sudozypperinstallpython3-gobjectpython3-gobject-Gdktypelib-1_0-Gtk-3_0libgtk-3-0
  3. Change the directory to where your hello.py script can be found
  4. Run python3hello.py
Installing from PyPI with pip:

Gtk Mac Bundle Install

Mac

Mac Gtk Theme

  1. Open a terminal and enter your virtual environment
  2. Execute sudozypperinstallcairo-develpkg-configpython3-develgccgobject-introspection-develto install the build dependencies and GTK
  3. Execute pip3installpycairo to build and install Pycairo
  4. Execute pip3installPyGObject to build and install PyGObject
  5. Change the working directory to where your hello.py script can be found
  6. Run python3hello.py

macOS¶

  1. Go to https://brew.sh/ and install homebrew
  2. Open a terminal
  3. Execute brewinstallpygobject3gtk+3
  4. Change the working directory to where your hello.py script can be found
  5. Run python3hello.py

For more details on how to use a virtualenv with PyGObject, see the“Creating a Development Environment” page.