Re: how ot create a button with a png image in it??
- From: muppet <scott asofyet org>
- To: bboett adlp org
- Cc: gtk-perl-list gnome org
- Subject: Re: how ot create a button with a png image in it??
- Date: Sun, 25 Apr 2004 12:41:15 -0400
On Sunday, April 25, 2004, at 11:44 AM, Bruno Boettcher wrote:
but i looked through the docu found out how to load xpm's and such
stuff, but couldn't get a hint on how lo actually load a png image
into a button???
depends on how you want to do it.
1) put a Gtk2::Image into the button, with normal widget layout
controls (the button is just a container).
2) create a new stock item that contains your image, then use
Gtk2::Button->new_from_stock ($newstockid);
both methods require you to get the image data from someplace:
a) load from files (e.g., Gtk2::Image->new_from_file() or
Gtk2::Gdk::Pixbuf->new_from_file()).
b) load from inlined image data (mostly
Gtk2::Gdk::Pixbuf->new_from_xpm_data() and friends)
check the Gtk2/examples directory, i believe most, if not all, of these
methods are used in there.
i recommend 2+b, personally; it's more work, but your code requires no
external data, and the stock mechanism does a lot of work for you
(scaling images, installing accelerators and mnemonics, etc).
--
I bring the rock, and provided it is fiscally responsible, I will bring
the funk as well. And that's fo-shizzle.
-- Saturday Night Live
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]