擅长:python、mysql、java
<p>还有另一种方法。在</p>
<p>另请参见:
<a href="http://mail.gnome.org/archives/gtk-perl-list/2005-July/msg00065.html" rel="nofollow">http://mail.gnome.org/archives/gtk-perl-list/2005-July/msg00065.html</a></p>
<p>(它是用perl编写的,但是转换成python应该不会太困难)</p>
<p>秘诀是:</p>
<p>假设你有一个树形视图,它使用树形树作为模型。其中一列使用combobox单元格呈现器,每行将获得一个ListStore模型:</p>
<ol>
<li><p>您可以将liststore放入TreeStore列中,在perl中,它将是<code>Gtk2::ListStore</code>类型的列。当然,您不会在TreeView中添加一个直接显示此内容的列。取而代之的是:</p></li>
<li><p>当您将comboboxcell列添加到Treeview时,可以使用“insert_column_with_attributes”并将“model”属性连接到TreeStore的ListStore列,将其用作其列表存储。</p></li>
<li><p>当您向treeview添加一行时,只需将一个完整的ListStore放入TreeStore的ListStore列中。然后,可以使用所需的任何值填充每行的ListStore。</p></li>
</ol>