How to structure the program.

First start a Python File and name it whatever you want. Eg – anyname.py

Open it with any text editor

  • Now let’s first import PyGTK

import gi

  • Now to make sure your program uses GTK 3, add the following line of code

gi.require_version(“GTK”, “3.0”)

So the first section of our code will be –

import gi
gi.require_version(“GTK”, “3.0”)

  • If you are familiar with GUI programming, we run the GUI component in side a loop. To do this PyGTK, add the following line of code –

Gtk.main()

So the whole code for now will be

import gi
gi.require_version(“GTK”, “3.0”)
//FIRST BLOCK 👆

//Mind this gap

//LAST BLOCK 👇
Gtk.main()

Run this to get nothing executed.

Leave a Comment