Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Perl-Gtk2::How to set a window background image.

by zentara (Archbishop)
on Feb 15, 2006 at 13:04 UTC ( [id://530368]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Perl-Gtk2::How to set a window background image.
in thread Perl-Gtk2::How to set a window background image.

i need time to digest this

I agree. There are some complications which set in, when you reset the background of a window that is already mapped to the screen. I noticed that if the dimensions of the render_to_drawable is not exactly the same as pixbuf dimensions, x-y errors would occur. These can be avoided by some logic to get the pixbuf x and y size, etc. But that brings up the problem of what happens if you resize the window? Will the image resize? How would you tile the image? etc.

I was thinking about it last night, and the gtk c-libs developers probably didn't want to bloat the code with all the logic it would take to enable swappable background images. So we see it can be done, but the provided methods of using the styles and xpm files, is easier, and will probably work well for most applications.


I'm not really a human, but I play one on earth. flash japh
  • Comment on Re^3: Perl-Gtk2::How to set a window background image.

Replies are listed 'Best First'.
Re^4: Perl-Gtk2::How to set a window background image.
by renegadex (Beadle) on Nov 22, 2008 at 03:03 UTC
    Hi! I think this is my first contribution hehe... I Got this code from the php cookbook, and converted it to Perl. It worked for me :)
    my $back_pixbuf = Gtk2::Gdk::Pixbuf->new_from_file("apple.png"); my ($pixmap,$mask) = $back_pixbuf->render_pixmap_and_mask(255); my $style = $window->get_style(); $style=$style->copy(); $style->bg_pixmap("normal",$pixmap); $window->set_style($style);
    NOTE: apple.png NOT INCLUDED.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://530368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 02:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found