pixbuf in a treestor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pixbuf in a treestor

Fabio Marzocca
Is there some hidden trick I don't know, to display a pixbuf in a TreeStore??

This is what I did:


the model:

$model = Gtk2::TreeStore->new (qw/
                Glib::String Glib::String Gtk2::Gdk::Pixbuf Glib::String
                Glib::String Glib::String / );

set the column:

$cell = Gtk2::CellRendererPixbuf->new;
$col = Gtk2::TreeViewColumn->new;
$col->pack_start($cell,2);
$col->add_attribute ($cell, pixbuf => 0);

load the pixbuf:
$redbar=Gtk2::Gdk::Pixbuf->new_from_file(ICONPATH."red.png");


show data:

$model->set ($iter,0, $name 1, $fullpath,
                                2, $redbar, 3, $perc,
                                4, calc($size), 5, $size);

But the column with the pixbuf is empty. No errors, the "text" columns are ok...
_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: pixbuf in a treestor

muppet-6

The Saltydog said:

> $model = Gtk2::TreeStore->new (qw/
> Glib::String Glib::String Gtk2::Gdk::Pixbuf Glib::String
> Glib::String Glib::String / );
>
> set the column:
>
> $cell = Gtk2::CellRendererPixbuf->new;
> $col = Gtk2::TreeViewColumn->new;
> $col->pack_start($cell,2);
> $col->add_attribute ($cell, pixbuf => 0);

Column 0 is the name.  Use "pixbuf => 2", instead.

...

> But the column with the pixbuf is empty. No errors, the "text" columns are
> ok...


--
muppet <scott at asofyet dot org>

_______________________________________________
gtk-perl-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list