Hi,

Having recently had my own struggle with ComboBoxen (more specifically ComboBoxEntry's), I can sum up my experience with the following statement: (Py)Gtk wants ComboBoxes' models to have a str column first!

I've tried using a ListStore(gobject.TYPE_PYOBJECT) (for my own models) with custom cell renderers specified (using set_cell_data_func()) and lost hours trying to get it to work. In the end, I ended up adding a str column as the _first_ column and "copying" a string representation of my objects to that column. This, in the end, does what I want: it saves a reference to one of my models in the ListStore. Moral of the story: adding a str column as the first column solved all my problems. If you want, you can check how I handle ComboBoxEntries: https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/spelt/spelt/gui/edit_area.py

In the first paragraph, I said (PyGtk), because I'm not sure if this is because of PyGtk or the C Gtk lib itself. The weird thing is that I'm using a ListStore(gobject.TYPE_PYOBJECT) with a TreeView and it works just great (in PyGtk and Gtk#)!

P. S. I'm not sure why, but I don't seem to receive any responses from Mr. Kintanar. :/

Isaac Alston wrote:
2008/6/22 Bertrand Son Kintanar <[EMAIL PROTECTED]>:
[...snip - code sample]
notice the if statement highlighted. this will show the column if we set the
flag to visible otherwise it will not show the column
Yes, I think this might work, although I am dubious about:
self.inputTreeView.append_column(column) because I don't think
ComboBox has that method. However, this seems to be a lot of work... I
was under the impression that gtk.ListStore was the model in a sort of
mvc system in which the view is independent from the model which
should easily allow different views. In this instance, it doesn't
appear to be the case, which is annoying. I will sleep on this :-) .

Thanks for your efforts,

begin:vcard
fn:Walter Leibbrandt
n:Leibbrandt;Walter
org:Translate.org.za
adr:;;;Pretoria;Gauteng;;South Africa
email;internet:[EMAIL PROTECTED]
title:Developer
tel;work:(012) 460 1095
x-mozilla-html:FALSE
url:http://translate.org.za
version:2.1
end:vcard

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to