GTK3: Storing None in Treeiter in int and decimal "column" type (original) (raw)
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
gwillems March 31, 2025, 8:50am 2
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?
system (system) Closed April 30, 2025, 8:50am 3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.