I\'ve created a simple window GUI in Glade 3.6.7 and I am trying to import it into Python. Every time I try to do so I get the following error:
(queryrelevan
You have created a GtkBuilder file instead of Glade file.
You can use GtkBuilder as follow:
builder = gtk.Builder()
builder.add_from_string(string, len(string))
builder.connect_signals(anobject)
builder.get_object(name)
EDIT:
When you start a new project in glade it asks you if you want create a glade file or a GtkBuilder file, which is new and more flexible. Try the builder file with the following code:
#!/usr/bin/env python
import gtk
class QueryRelevanceEvaluationApp:
def __init__(self):
filename = "foo.glade"
builder = gtk.Builder()
builder.add_from_file(filename)
builder.connect_signals(self)
def on_buttonGenerate_clicked(self, widget):
print "You clicked the button"
app = QueryRelevanceEvaluationApp()
gtk.main()
EDIT2:
Beware that i cannot see any handler in your GtkBuilder file
I had the same problem Pete mentioned. After the answer that mg gave, what I did is to save the .glade file in a liblgade format instead of GTKBuilder. On the Save As.. dialog box, at the bottom you have the option "File Format" click on "liblglade" and voila!!!!