Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1413  / 1 Year ago, tue, december 13, 2022, 6:11:11

Possible Duplicate:

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






I'm following along with this tutorial, but came to a stopping point where the program has an issue with the lineif response == gtk.RESPONSE_OK. This happens after clicking Open, then selecting a directory and clicking OK. The error message is "NameError: global name 'gtk' is not defined" So I researched it and found that apparently we need to import a couple things:



import pygtk
pygtk.require("2.0")
import gtk


If I add this to the SimpleMediaPlayerWindow.py, then the program won't run at all, giving an error message:



/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type `PyGtkGenericCellRenderer' is smaller than the parent type's `GtkCellRenderer' class size
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 thought all these things were installed and configured properly during the installation of quickly. Any suggestions?



On a side note, there are a few typos in the tutorial which may make it slightly difficult to follow. When deleting pre-existing containers from the window, it says "Navigate the list of children and delete label1" twice, but the second time it's actually referring to label2. "Find Horizontal Panes under the Containers tab..." actually should read "Find Paned under the Containers tab..." (maybe this changed with an updated version of glade). Lastly (so far), "Then add to your on_on_openbutton_clicked function" there's once too many on's in that function name.


More From » python

 Answers
5

I ran into the same problem and found that the correct syntax is not
if response == gtk.RESPONSE_OK. It should be if response == Gtk.ResponseType.OK .
This solved my problem and hope it will solve yours also.
Reference: https://bugs.launchpad.net/ubuntu/+source/quickly/+bug/929572


[#38270] Wednesday, December 14, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
heaco

Total Points: 479
Total Questions: 124
Total Answers: 114

Location: Lesotho
Member since Sat, Oct 1, 2022
2 Years ago
;