How to Create GUI Applications Under Linux Desktop Using PyGObject – Part 1

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Hanny Helal

A Linux & Foss user since 2010, working on many projects in the field of Free Software.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

13 Responses

  1. Jignesh says:

    I am new in developing GUI Application. Which is the best way to develop GUI App in gtk?

    Using Glade and writing GUI interface design code

  2. Paul says:

    None of your examples work…copying and pasting the code you provided gives me nothing but errors:

    “IndentationError: expected an indented block”

    PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version(‘Gtk’, ‘3.0’) before import to ensure that the right version gets loaded.
    from gi.repository import Gtk

    • Angel says:

      I would like to see an answer to this issue as I am having the same problem.

    • Christopher Truebig says:

      typing the code and make sure the indentation is consistent in python.
      this is a good website for learning pygtk with python 3

    • 4kd says:

      Had the same issue. A bit of Google and I found this:

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

      Concerning indention:
      Seems like the formatting was just lost. In python tabulation is used instead of bracketing. Colon must be followed by tabulated code, meaning that it’s a part of the block. It’s easy to restore if you can read the code for the slightest.

  3. NickJ says:

    File “./”, line 5
    def __init__(self):
    IndentationError: expected an indented block

  4. Amadeus says:

    Very useful tutorial. Thank you!

  5. Anonymus says:

    You have a minor syntax error in the first script, try to add parentheses to the print command

  6. Jimmy says:

    There is an error in the script of the builder. The name of the function in the Handler() should be the same as the one in glade.

    Instead of buttonclicked, it should be button1_clicked ;)

    Thanks for this tuto! Really helpful

  7. Israel says:

    Thanks a lot !!
    it’s exactly what I need

  8. Virneto says:

    Very cool and usefull content.
    I’ve put it already in my task list.


Got something to say? Join the discussion.

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