Hi,<br><br>I want to put my icons in the treeview cell.&nbsp;&nbsp; I have found this example code (<a href="http://www.pygtk.org/pygtk2tutorial/examples/treeviewcolumn.py">http://www.pygtk.org/pygtk2tutorial/examples/treeviewcolumn.py</a>) and tried to change it:<br>
<br>#!/usr/bin/env python<br><br>import pygtk<br>pygtk.require(&#39;2.0&#39;)<br>import gtk<br><br>class TreeViewColumnExample:<br><br>&nbsp;&nbsp;&nbsp; # close the window and quit<br>&nbsp;&nbsp;&nbsp; def delete_event(self, widget, event, data=None):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk.main_quit()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return False<br><br>&nbsp;&nbsp;&nbsp; def __init__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Create a new window<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.window.connect(&quot;delete_event&quot;, self.delete_event)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.liststore = gtk.ListStore(str, str, str, &#39;gboolean&#39;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.treeview = gtk.TreeView(self.liststore)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.tvcolumn = gtk.TreeViewColumn(&#39;Pixbuf and Text&#39;)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pixbuf = gtk.gdk.pixbuf_new_from_file(&#39;arch.png&#39;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # &lt;-- my code<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.liststore.append([&#39;Open&#39;, gtk.STOCK_OPEN, &#39;Open a File&#39;, True])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.liststore.append([&#39;New&#39;, pixbuf, &#39;New File&#39;, True])&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # &lt;-- my code<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.liststore.append([&#39;Print&#39;, gtk.STOCK_PRINT, &#39;Print File&#39;, False])<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.treeview.append_column(self.tvcolumn)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # create a CellRenderers to render the data<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.cellpb = gtk.CellRendererPixbuf()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.cell = gtk.CellRendererText()<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # add the cells to the columns - 2 in the first<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.tvcolumn.pack_start(self.cellpb, False)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.tvcolumn.pack_start(self.cell, True)<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.tvcolumn.set_attributes(self.cellpb, stock_id=1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.tvcolumn.set_attributes(self.cell, text=0)<br><br>&nbsp;&nbsp;&nbsp; self.treeview.set_search_column(0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.tvcolumn.set_sort_column_id(0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.treeview.set_reorderable(True)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.window.add(self.treeview)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.window.show_all()<br><br>def main():<br>&nbsp;&nbsp;&nbsp; gtk.main()<br><br>if __name__ == &quot;__main__&quot;:<br>&nbsp;&nbsp;&nbsp; tvcexample = TreeViewColumnExample()<br>&nbsp;&nbsp;&nbsp; main()<br><br>But it doesn&#39;t work.&nbsp; How can I display the icon from file in TreeView?&nbsp; <br>
And what is &quot;stock&quot;?&nbsp; How can I put my icon in this &quot;stock&quot;?<br><br>Thanks in advance,<br>Andrey<br>