Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am fairly new to both quickly and Python. I am facing several problems while learning to use quickly from the following tutorial on the Ubuntu developers site:

The following error I'm unable to understand:

Traceback (most recent call last):
  File "/home/sumit/Sumit/simple-player/simple_player/", line 36, in on_openbutton_clicked
    if response==gtk.RESPONSE_OK:
NameError: global name 'gtk' is not defined

I realize that I am supposed to import something, so I tried to add import gtk which it didn't work and it gave the following error:

  from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/ Warning: g_type_get_qdata: assertion `node != NULL' failed
  from gtk import _gtk

I have followed every step of the tutorials so far. But there is no mention of any other imports other that "prompts" and "os". Please help.

Contribution of Agmenor, facing the same problem:

I also tried to replace the text if response == gtk.RESPONSE_OK: by if response == Gtk.RESPONSE_OK: (notice the capital G). This gives another error:

AttributeError: 'gi.repository.Gtk' object has no attribute 'RESPONSE_OK'
share|improve this question
"Didn't work" is somewhat the most useless thing to say. What happened when you did a "import gtk" at the top? Do you get another traceback? Some other error? – Timo Jun 15 '12 at 18:59
I answered that comment by editing the question. – Agmenor Jun 16 '12 at 2:30

The current quickly toolkit on 12.04 uses Gtk from gi.repository not the older gtk.
The tutorial has not been updated for this change.

This may be a/your sticking point.

Output cat

from gi.repository import Gtk # pylint: disable=E0611
import logging
logger = logging.getLogger('simple_player')


share|improve this answer
Skimming through that page, I see alot of references to just gtk and gtk.gdk, so this is probably not the case. – Timo Jun 15 '12 at 19:01
@Timo fair point, see the edit – RobotHumans Jun 15 '12 at 19:06
up vote 2 down vote accepted

I replaced "gtk.RESPONSE_OK" with "Gtk.ResponseType.OK"

Now everything is working correctly.

Found it here:

share|improve this answer
it seems like this is exactly what i originally suggested in my answer – RobotHumans Jun 16 '12 at 12:02
Thank you sumit_gt. Please accept your own answer with the check sign. Aking1012, I share sumit_gt's likely opinion that your answer was not detailed enough for us beginners. – Agmenor Jun 17 '12 at 1:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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