Re: [pygtk] Double row in a liststore, or in a Treeview
Below is a basic example. Essentially, when populating the ListStore you need to insert '\n' to indicate the line break. #!/usr/bin/env python import gtk window = gtk.Window() window.connect(destroy, lambda q: gtk.main_quit()) liststore = gtk.ListStore(str) liststore.append([apple.jpg\n314KB]) liststore.append([orange.jpg\n495KB]) liststore.append([banana.jpg\n417KB]) treeview = gtk.TreeView(liststore) treeviewcolumn = gtk.TreeViewColumn() treeview.append_column(treeviewcolumn) cellrenderertext = gtk.CellRendererText() treeviewcolumn.pack_start(cellrenderertext, True) treeviewcolumn.add_attribute(cellrenderertext, text, 0) window.add(treeview) window.show_all() gtk.main() Obviously you'll be wanting to dynamically specify the values rather than statically as above (i.e. filename, file size, etc) so you can make use of string formatters such as %s: filename = grapes.png filesize = 557KB liststore.append([%s\n%s % (filename, filesize)]) Hope that helps. On Thu, 2011-10-27 at 20:41 -0300, craf wrote: Hi. I wonder if it is possible that a liststore has a double row, such as using the Firefox download page. Example - |Downloads|x| - |Space.pdf 20:23 | | ICON 4.9 MB - google.cl | | | | ICON Picture_sky.jpeg | |205 KB - google.cl | | | --- Any indication, Thanks Regards. Craf ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ -- Andrew Steele andrew.ste...@gmx.com ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] Double row in a liststore, or in a Treeview
Hi Andrew. Thank you for your answer!! The code works very Fine!. Best Regards Cristian. -Mensaje original- De: Andrew Steele andrew.ste...@gmx.com Para: craf pyclut...@gmail.com Cc: Pygtk pygtk@daa.com.au Asunto: Re: [pygtk] Double row in a liststore, or in a Treeview Fecha: Fri, 28 Oct 2011 09:35:18 +0100 Below is a basic example. Essentially, when populating the ListStore you need to insert '\n' to indicate the line break. #!/usr/bin/env python import gtk window = gtk.Window() window.connect(destroy, lambda q: gtk.main_quit()) liststore = gtk.ListStore(str) liststore.append([apple.jpg\n314KB]) liststore.append([orange.jpg\n495KB]) liststore.append([banana.jpg\n417KB]) treeview = gtk.TreeView(liststore) treeviewcolumn = gtk.TreeViewColumn() treeview.append_column(treeviewcolumn) cellrenderertext = gtk.CellRendererText() treeviewcolumn.pack_start(cellrenderertext, True) treeviewcolumn.add_attribute(cellrenderertext, text, 0) window.add(treeview) window.show_all() gtk.main() Obviously you'll be wanting to dynamically specify the values rather than statically as above (i.e. filename, file size, etc) so you can make use of string formatters such as %s: filename = grapes.png filesize = 557KB liststore.append([%s\n%s % (filename, filesize)]) Hope that helps. On Thu, 2011-10-27 at 20:41 -0300, craf wrote: Hi. I wonder if it is possible that a liststore has a double row, such as using the Firefox download page. Example - |Downloads|x| - |Space.pdf 20:23 | | ICON 4.9 MB - google.cl | | | | ICON Picture_sky.jpeg | |205 KB - google.cl | | | --- Any indication, Thanks Regards. Craf ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
[pygtk] Double row in a liststore, or in a Treeview
Hi. I wonder if it is possible that a liststore has a double row, such as using the Firefox download page. Example - |Downloads|x| - |Space.pdf 20:23 | | ICON 4.9 MB - google.cl | | | | ICON Picture_sky.jpeg | |205 KB - google.cl | | | --- Any indication, Thanks Regards. Craf ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/