You are not logged in.
#!/usr/bin/python
from gi.repository import Gtk
def get_builder(path):
builder = Gtk.Builder
builder.add_from_file(path)
return builder
some_builder = get_builder('test.ui')
results in the error
Traceback (most recent call last):
File "./test.py", line 10, in <module>
some_builder = get_builder('test.ui')
File "./test.py", line 7, in get_builder
builder.add_from_file(path)
File "/usr/lib/python3.2/site-packages/gi/types.py", line 43, in function
return info.invoke(*args, **kwargs)
TypeError: add_from_file() takes exactly 2 arguments (1 given)
I'm confused. This is not what the documentation says!
Last edited by AaronBP (2012-08-22 06:06:42)
Offline
#!/usr/bin/python
from gi.repository import Gtk
def get_builder(path):
builder = Gtk.Builder()
builder.add_from_file(path)
return builder
some_builder = get_builder('test.ui')
You need to create an object instance of Builder.
Offline