[gtk] - My image the Treeview column

A

Andrey Demidov

Hi all,

I need to display the images in the one of columns in the Treeview.
I have found this example
(http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-pxbr).

But in this example are used the standard gnome icons:
parent[$pixbuf] = Gtk::Stock::DIALOG_INFO

I have tried to change code to:

pixbuf = Gdk::pixbuf.new('/home/demas/settings/awn_icons/emacs.png')
parent[$pxbuf] = pixbuf

but it doesn't work.

How can I display images in the threeview column?
 
A

Andrey Demidov

I think I have found the answer:

user_renderer = Gtk::CellRendererPixbuf.new
col = Gtk::TreeViewColumn.new
col.title = "pic"
col.pack_start(user_renderer, false)

pixbuf = Gdk::pixbuf.new('/home/demas/settings/awn_icons/emacs.png')
user_renderer.set_pixbuf(pixbuf)
 
A

Andrey Demidov

Or better:

iter = @store.append
iter[0] = twi.message()
iter[1] =
Gdk::pixbuf.new('/home/demas/settings/awn_icons/emacs.png')

....

user_renderer = Gtk::CellRendererPixbuf.new
col = Gtk::TreeViewColumn.new
col.title = "pic"
col.pack_start(user_renderer, false)
col.add_attribute(user_renderer, 'pixbuf', 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top