How To Install Pycairo Examples
How To Install Pycairo Examples In Photoshop
Import gi gi. Requireversion ( 'Gtk', '3.0' ) from gi.repository import Gtk window = Gtk. Window ( title = 'Hello World' ) window. Show window.
Connect ( 'destroy', Gtk. Mainquit ) Gtk. Main Before we can run the example application we need to install PyGObject, GTKand their dependencies. Follow the instructions for your platform below.After running the example application have a look at the “” for more exampleson how to create GTK apps and the “” for API documentation for all supportedlibraries. Windows.
Go to and download the x8664 installer. Follow the instructions on the page for setting up the basic environment. Run C:msys64mingw64.exe - a terminal window should pop up. Execute pacman -Suy. Execute pacman -S mingw-w64-x8664-gtk3 mingw-w64-x8664-python3 mingw-w64-x8664-python3-gobject. To test that GTK 3 is working you can run gtk3-demo.
Copy the hello.py script you created to C:msys64home. In the mingw32 terminal execute python3 hello.py - a window should appear. Ubuntu / Debian Installing the system provided PyGObject:.
Open a terminal. Execute sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0. Change the directory to where your hello.py script can be found (e.g.
Cd Desktop). Run python3 hello.pyInstalling from PyPI with pip:. Open a terminal and enter your virtual environment. Execute sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0to install the build dependencies and GTK. Execute pip3 install pycairo to build and install Pycairo. Execute pip3 install PyGObject to build and install PyGObject. Change the working directory to where your hello.py script can be found.
Run python3 hello.py.