[EMAIL PROTECTED] wrote:
>
> On Mon, 31 Jul 2000 10:29:55 +0200, Javi Roman <[EMAIL PROTECTED]> wrote:
> > > I have the following code:
> > >
> > > from gtk import *
> > >
> > > rcfile = """
> > > pixmap_path "/home"
> > > style "back" {
> > > bg_pixmap[NORMAL] = "image.xpm"
> > > }
> > > widget "*mystyle" style "back"
> > > """
> > >
> > > Everything works correctly. But the load of the image is very slow,
> > > therefore I have tried to use the following thing:
> > >
> > > from gtk import *
> > >
> > > rcfile = """
> > > pixmap_path "/home"
> > > style "back" {
> > > bg_pixmap[NORMAL] = "image.png"
> > > }
> > > widget "*mystyle" style "back"
> > > """
> > >
> > > It does not load the PNG image, why?.
> > > In other programs I have seen that they load PNG images without
> > > problems.
>
> Note: I don't know much about the gtk rc stuff.
>
> I think what you've seen the other programs use is a gtk-theme-engine,
> not the "regular" rc parsing.
I just did some digging around in the Gtk+ source code, and it looks
as though, by default, Gtk+ knows how to load XPM images only.
>From gtk+-1.2.7/gtk/gtkrc.c\gtk_rc_load_image():
if(image_loader)
return image_loader(NULL, colormap, NULL,
transparent_color,
filename);
else
return gdk_pixmap_colormap_create_from_xpm (NULL, colormap, NULL,
transparent_color,
filename);
image_loader is a static GtkImageLoader, visible only within
gtkrc.c. It is set via the public function gtk_rc_set_image_loader.
This function is not wrapped by gnome-python, and appears not to be
used by any of the Gtk+ theme engines. But they all appear to use
their own image loaders. (This is a guess based on output from nm;
I don't have the sources lying around.)
A "find | grep" through the themes that come with Helix-Gnome shows
that every theme specifies an .XPM file when setting bg_pixmap
resources.
(Okay, some of them specify "<parent>".)
In short, if you want to use a PNG file, it looks like you have to
use a theme engine.
Like acano, I'm not well-versed with theme engines. If you have a
Mandrake system, have a look at the gtkrc files under
/usr/share/themes.
--
Mitch Chapman
[EMAIL PROTECTED]
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk