470,586 Members | 1,438 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,586 developers. It's quick & easy.

[python-gtk] problem with multiple inheritance


Hi

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

class view_tree_model(gtk.GenericTreeModel,gtk.TreeSorta ble):

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

--
Zamiast sensownej sygnatury...:
| http://www.safetycam.pl | http://www.bpcc.org.pl/en,0,0.html |
http://www.spoko.neostrada.pl | http://www.gorny.najlepsze.pl/imiona
Jul 19 '05 #1
3 1827
Taki Jeden wrote:
class view_tree_model(gtk.GenericTreeModel,gtk.TreeSorta ble):

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.

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
Jul 19 '05 #2
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
On 6/2/05, Greg Ewing <gr**@cosc.canterbury.ac.nz> wrote:
Taki Jeden wrote:
class view_tree_model(gtk.GenericTreeModel,gtk.TreeSorta ble):

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.

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list

--
Christopher Lambacher
la******@computer.org
Jul 19 '05 #3
Greg Ewing wrote:
Taki Jeden wrote:
class view_tree_model(gtk.GenericTreeModel,gtk.TreeSorta ble):

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.


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

--
Zamiast sensownej sygnatury...:
| http://www.safetycam.pl | http://www.bpcc.org.pl/en,0,0.html |
http://www.spoko.neostrada.pl | http://www.gorny.najlepsze.pl/imiona
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Olaf Meyer | last post: by
3 posts views Thread by Saravanan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.