Facing problem with "gtk.RESPONSE_OK" in the simple-player quickly tutorial

Posted by sumit_gt on Ask Ubuntu See other posts from Ask Ubuntu or by sumit_gt
Published on 2012-06-15T18:49:21Z Indexed on 2012/06/16 3:23 UTC
Read the original article Hit count: 375

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: http://developer.ubuntu.com/resources/app-developer-cookbook/multimedia/creating-a-simple-media-player/

The following error I'm unable to understand:

Traceback (most recent call last):
  File "/home/sumit/Sumit/simple-player/simple_player/SimplePlayerWindow.py", 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/__init__.py:40: 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'

© Ask Ubuntu or respective owner

Related posts about python

Related posts about application-development