Kashif
Kashif

Reputation: 1263

How to change or view gtk.ListStore flags in Python

I have a TreeView connected with a ListStore object. One of the function calls ListStore.get_iter_next(). Since the ListStore data changes every time, I am doubtful that iter is causing a memory leak.

I need to check if the ListStore has gtk.TREE_MODEL_ITERS_PERSIST flag set and unset it as described in TreeModel.get_flags() documentation.

How could I do that?

Upvotes: 1

Views: 190

Answers (1)

Jon Clements
Jon Clements

Reputation: 142156

It would appear you would just use bitwise operations on it - for example:

>>> a = 3 # just some number
>>> format(a, 'b') # display as a bit string so we can see what's going on
'11'
>>> a & 1 # check first bit is set
1
>>> a & 2 # check second bit is set
2 
>>> a ^= 1 # unset a bit
>>> format(a, 'b') # display for checking again...
'10'

Except you would use gtk.TREE_MODEL_ITERS_PERSIST instead... whether this is the right approach to your problem - I'm not sure - but answers your direct question as to how you could unset it.

Upvotes: 1

Related Questions