[pygtk] help with TreeStore
John Finlay
finlay at moeraki.com
Sun Jun 11 18:28:38 WST 2006
Sandro Dentella wrote:
> On Sat, Jun 10, 2006 at 09:08:27PM -0500, Benjamin Montgomery wrote:
>
>> On Sat, 2006-06-10 at 15:35 -0700, John Finlay wrote:
>>
>>> If it is a Python object and not a PyGTK GObject then use
>>> gobject.TYPE_PYOBJECT as the column type. gobject.TYPE_PYOBJECT will
>>> also work for PyGTK GObjects as well.
>>>
>> gobject.TYPE_PYOBJECT works exactly as I wanted. I missed it since it
>> isn't listed in the reference manual.
>>
>
>
> In some circumnstancies I have used 'object' directly. It seems to work
> eather. Is it translated to gobject.TYPE_PYOBJECT internally? is it wrong to
> use 'object'?
>
>
object is translated internally and is acceptable. You can also use str,
int, long, and bool.
> When storing number I have used 'int' but to find out that I was not allowed
> to go back to change the value back to 'None' (TypeError: value is of the
> wrong type for this column). Is there a way to set the value of a ListStore
> to None in that case?
>
>
I think you'd have to use TYPE_PYOBJECT to have an int and None in the
same column
> One last question. I have not found a way to query a ListoStore/TreeStore to
> output which are its column definitions, so no way to create a inspector. Is
> it possible?
>
>
liststore.get_column_type(index)
John
More information about the pygtk
mailing list