You are not logged in.

#1 2012-08-22 04:48:47

AaronBP
Member
Registered: 2012-08-06
Posts: 140
Website

[solved] Builder.add_from_file takes 2 arguments?

#!/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

#2 2012-08-22 05:33:47

bzt
Member
From: Germany
Registered: 2010-04-11
Posts: 38

Re: [solved] Builder.add_from_file takes 2 arguments?

#!/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.


My Arch Linux related PKGBUILD pastes: http://pastebin.com/u/bzt

Offline

#3 2012-08-22 06:06:26

AaronBP
Member
Registered: 2012-08-06
Posts: 140
Website

Re: [solved] Builder.add_from_file takes 2 arguments?

Fucking hell. After a certain number of ours the parans start to blur together. Sorry about that.

Offline

Board footer

Powered by FluxBB