Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm start programming in Python and I want learn GTK+ 3. I'm using a Distro based on Ubuntu 12.04 (Elementary OS) and I'm having some troubles to install GTK+ 3 in Python.

Okay, I will show you what I'm trying do.

First -> Following this tuto, I wrote this simple code for generate a Window using GTK+ 3.

    #!/usr/bin/python
    from gi.repository import Gtk

    win = Gtk.window()
    win.connect("delete-event", Gtk.main_quit)
    win.show_all()
    Gtk.main()

Second -> I have the following error:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    win = Gtk.window()
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 243, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 105, in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.Gtk' object has no attribute 'window'

Third -> Trying to find the error, I found this guide that I skipped before try to run "main.py". I'm trying to follow this guide because I don't know if Elementary (Ubuntu 12.04) have GTK+ 3, PyGObject and other things necessary for develop GTK+ 3 applications with Python, by default.

Forth -> Summarizing, I'm having problems trying to install JHBuild. I successfully followed this guide of how to install Jhbuild until 2.1 item. But when I try to run

jhbuild sanitycheck

I have the following error message:

jhbuild: could not load config file, /home/paladini/.jhbuildrc is missing

How can I solve this issues and finally use GTK+ 3 with Python?

share|improve this question

closed as off-topic by Takkat, Mateo, karel, psusi, Eric Carvalho Oct 15 '13 at 0:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – Takkat, Mateo, karel, psusi, Eric Carvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Maybe you should give part 2.2 of the JHBuild install instruction another try, save a copy of their examples/sample.jhbuildrc as ~/.jhbuildrc and try again, won't hurt much. –  arsaKasra Oct 13 '13 at 13:12
    
Thanks @arsaKasra, but Timo already solved my problem. –  Fernando Paladini Oct 13 '13 at 13:18
add comment

1 Answer 1

up vote 5 down vote accepted

It's not a problem with your installation, but with your code.

Change

win = Gtk.window()

to

win = Gtk.Window()
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.