How to make GtkListStore store object attribute in a row?

ぐ巨炮叔叔 提交于 2019-12-01 10:49:02

Two mistakes in the second-to-last block.

  1. GtkWarning: gtk_tree_view_column_cell_layout_set_cell_data_func: assertion `info != NULL'

    In English, this means that the cell renderer is not in the column's list of cell renderers. You need to add the cell renderer to the column first before calling set_cell_data_func.

  2. Warning: unable to set property `text' of type `gchararray' from value of `typedata+TrayIcon+Series'

    This is because the add_attribute line causes GTK+ to try setting the cell text to a Series object, which of course fails. Just remove that line; the cell data func already takes care of setting the cell text.

In code:

col = gtk.TreeViewColumn(_("Series title"))
cell = gtk.CellRendererText()
col.pack_start(cell)
col.set_cell_data_func(cell, get_series_title)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!