GTK3: Storing None in Treeiter in int and decimal "column" type

Hi I have a issue in my program use 0 and None and treview don’t allow to store None in columns of type int or decimal.

Is a very big problem to me, is posible override append methods. any example?

Thanks in advance

store = Gtk.ListStore(int, str, float)
treeiter = store.append([None,None,None])
print(store[treeiter][0],store[treeiter][1],store[treeiter][2])
#output 0 None 0.0

---
store = Gtk.TreeStore()
store.set_column_types([int, str, float])
treeiter = store.append(None, [None,None,None])
print(store[treeiter][0],store[treeiter][1],store[treeiter][2])
#output 0 None 0.0

Hi,

Yes, that’s expected. The Gtk.ListStore types are actually converted to their C equivalent, so the Python None will be evaluated and stored as 0 C integer.

No, the problem is the underlying type, not the API.

Can you please explain what you are trying to achieve?
Why do you need to handle None and 0 differently?
And how do you plan to display the None in the UI?

1 Like