Gtk - Image via HTTP in TreeView

Hi there,

I'm just writing my first ruby-gtk application. But already there are the
first problems :slight_smile:

In my application I have a treeview with 2 columns. In the second column,
I wanna display some text, that works. In the first column I'm trying to
display an image. It should be a image from an external server. So first I
have to grab the image, but how should I do that? After that I have to
display it in the treeview, but this also doesn't work. Here are my first
tries:

@treeview = @glade.get_widget("treeview")

@treestore = Gtk::TreeStore.new(Gdk::Pixbuf, String)
@treeview.model = @treestore

@renderer = Gtk::CellRendererText.new

col = Gtk::TreeViewColumn.new("Image", @renderer, nil)
@treeview.append_column(col)

col = Gtk::TreeViewColumn.new("Description", @renderer, :text => 0)
#What is the :text => for? I know, that are attributes. But what can I set
here?

@treeview.append_column(col)

#Inserting an element

newStore = @treestore.append(nil)
newStore[0] = Gtk::Image.new("http://myurl/meinpicture.png")
newStore[1] = "test"

This does not work. Any ideas?

Greetings

Mike

Hi,

Hi there,

I'm just writing my first ruby-gtk application. But already there are the
first problems :slight_smile:

In my application I have a treeview with 2 columns. In the second column,
I wanna display some text, that works. In the first column I'm trying to
display an image. It should be a image from an external server. So first I
have to grab the image, but how should I do that? After that I have to
display it in the treeview, but this also doesn't work. Here are my first
tries:

Use Gtk::CellRendererPixbuf to render pixbuf.

Try gtk/sample/misc/treeview.rb.

col = Gtk::TreeViewColumn.new("Description", @renderer, :text => 0)
#What is the :text => for? I know, that are attributes. But what can I set
here?

The column of the store. In this case, 0 means Gdk::Pixbuf, 1 means String.

Read "Ruby/GTK TreeView Tutorial", please.
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview

···

On Fri, 11 Feb 2005 09:35:02 +0900 Michael Gebhart <mail@miketech.net> wrote:

--
.:% Masao Mutoh<mutoh@highway.ne.jp>

Hi,

ok, I'll try, thanks.

Michael