in reply to Perl-Gtk2::How to set a window background image.
sub set_bg{ my $pixbuff = Gtk2::Gdk::Pixbuf->new_from_file("1Zen16.png"); #set the new pixbuff in a vbox my $gdkwindow = $vbox1->window; # how to get the drawable, $widget->get_parent_window # did not work for me # although the drawable seems to have # the identical hash # ???? my ($drawable, $x_offset, $y_offset) = $gdkwindow->get_internal_paint_info; print "$drawable, $x_offset, $y_offset\n"; my $gc = Gtk2::Gdk::GC->new ($gdkwindow, undef); print "$gc\n"; $pixbuff->render_to_drawable($drawable, $gc, 0,0,0,0,500,430,'normal',0,0); #this was needed, to make the image actually change Gtk2->main_iteration while Gtk2->events_pending; $window->show_all(); return FALSE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl-Gtk2::How to set a window background image.
by turo (Friar) on Feb 15, 2006 at 09:09 UTC | |
by zentara (Cardinal) on Feb 15, 2006 at 13:04 UTC | |
by renegadex (Beadle) on Nov 22, 2008 at 03:03 UTC |