2

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?

2
  • 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, 2013 at 13:12
  • Thanks @arsaKasra, but Timo already solved my problem. Oct 13, 2013 at 13:18

1 Answer 1

7

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

Change

win = Gtk.window()

to

win = Gtk.Window()
0

Not the answer you're looking for? Browse other questions tagged .