In the beginning, we have to import the Gtk module to be able to
access GTK+’s classes and functions.
Since a user’s system can have multiple versions of GTK+ installed at the same,
we want to make sure that we when we import Gtk that it referrs to GTK+ 3
and not any other version of the library, which is the purpose
of statement gi.require_version('Gtk','3.0').

The next line creates an empty window.

win=Gtk.Window()

Followed by connecting to the window’s delete event to ensure that the
application is terminated if we click on the x to close the window.

win.connect("delete-event",Gtk.main_quit)

In the next step we display the window.

win.show_all()

Finally, we start the GTK+ processing loop which we quit when the window is
closed (see line 5).

Gtk.main()

To run the program, open a terminal, change to the directory of the file, and
enter: