简体   繁体   中英

how do I iterate over a “gslist” in Python?

Let's say I get a glib gpointer to a glib gslist and would like to iterate over the latter, how would I do it?

I don't even know how to get to the gslist with the gpointer for starters!

Update : I found a workaround - the python bindings in this instance wasn't complete so I had to find another solution.

How is glib exposed to Python in your application? Via SWIG, ctypes or something else?

You should basically use glib 's own functions to iterate over a list. Something like g_slist_foreach . Just pass it the pointer and its other parameters to do the job. Again, this heavily depends on how you access glib in your Python application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM