[python-gtk] problem with multiple inheritance

T

Taki Jeden

Hi

I'm trying to install a certain python program which uses gtk, and the
following line:

class view_tree_model(gtk.GenericTreeModel,gtk.TreeSortable):

raises a "TypeError: multiple bases have instance lay-out conflict"
Is this a bug in gtk, or python-gtk, or something? I know of people who run
this program, so I guess sthg must be wrong in my system.

I have Mdk 10.0, and in particular:

pygtk2.0-wrapper-2.0.0-2mdk
libgtk+1.2-1.2.10-38mdk
gtk+2.0-2.4.9-9mdk
pygtk2.0-2.0.0-2mdk
libgtk+2.0_0-2.4.9-9mdk
pygtk2.0-libglade-2.0.0-2mdk
gtkdialogs-2.1-1mdk
gtk-engines-0.12-8mdk

Anybody can help?

Thx
Bartek
 
G

Greg Ewing

Taki said:
class view_tree_model(gtk.GenericTreeModel,gtk.TreeSortable):

raises a "TypeError: multiple bases have instance lay-out conflict"
Is this a bug in gtk, or python-gtk, or something?

It's not a bug, it's a limitation of the way Python
handles inheritance from built-in types. You can only
inherit from more than one built-in type if they have
compatible C structures, and it appears that the two
you're trying to inherit from aren't compatible.

You'll have to think of some way of doing whatever
you're trying to do without inheriting from multiple
gtk types.
 
C

Chris Lambacher

One way to get around this would be to omit the TreeSortable interface
and use TreeModelSort to do the sorting instead. It doesn't look like
GenericTreeModel is designed to also support the TreeSortable
interface (you would need something like GenericTreeSortable since you
would need some magic to allow gobject inheritance from python.)

-Chris
 
T

Taki Jeden

Greg said:
It's not a bug, it's a limitation of the way Python
handles inheritance from built-in types. You can only
inherit from more than one built-in type if they have
compatible C structures, and it appears that the two
you're trying to inherit from aren't compatible.

You'll have to think of some way of doing whatever
you're trying to do without inheriting from multiple
gtk types.

Ok, but the code isn't mine - it is tinyERP (tinyerp.org). And people are
running it, that's why I assume the problem is not in the code.

BG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top