How to Install python-gobject on Kali Linux 2022.4

In this article, we are going to learn How to Install python-gobject on Kali Linux. To get things started we will try to run a very simple GTK based GUI application using the PyGObject provided Python bindings. First create a small Python script called hello.py with the following content and save it somewhere:

Example:

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

window = Gtk.Window(title="Hello World")
window.show()
window.connect("destroy", Gtk.main_quit)
Gtk.main()

Install PyGObject on Kali Linux

Before we can run the example application we need to install PyGObject, GTK and their dependencies. Follow the instructions below.

Installing the system provided PyGObject

Installation

Open the terminal and run the following command in it.

$ sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0

Installing from PyPI with pip

Open a terminal to install the build dependencies and GTK by running this command:

$ sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0

Install the pip3

We have to install the pip3 in our Kali Linux by this command.

$ sudo apt install python3-pip

Build and install Pycairo

pip3 install pycairo

 Install PyGObject

pip3 install PyGObject

After installing these packages you have to change the working directory to where your hello.py script can be found. And run the following command:

python3 hello.py

Install PyGObject in Kali Linux

Important Things To Remember:

The author of this article does not promote any illegal activities It is just for education purpose All the activities provided in this article, YouTube channel, and on the website techdhee.org are only for educational purposes. If you are using and follow this tutorial for any illegal purpose, techdhee.org can not be responsible for your action. My purpose is to educate or share the information who have not, how to secure your self from the Internet, and the world of digital. Also, read the Disclaimer

Finally

Thank you for reading this post and keep connected to TECH DHEE to continue enjoying excellent posts. Share your views about this post in the comment section below. If you still have any queries, throw it in the comment section. If you find this post helpful, don’t hesitate to share this post on your social network. It will only take a moment, and also it is quite easy and useful for others.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *