Re: jpg or png in gtk_window background?

On Sat, Feb 22, 2003 at 11:48:58AM +0100, Markus Wolters wrote:
Thanks for that,

but I can't get my gtk_window to work with gdk_window_set_back_pixmap().

Maybe someone can give me a code example?

What in particular is not working?

One thing that is not quite clear from what I referred you to is that
you must pass GTK_TRUE to gtk_widget_set_app_paintable.

Other than that the calls should be pretty self explanatory. I tested
the method described using PyGTK, and it worked fine.

Here is a hint, as a C snippet, based on the Python code I tried:

GError *err;
GtkWindow *win;
GdkPixbuf *pixbuf;
GdkPixmap *pixmap;

pixbuf = gdk_pixbuf_new_from_file("image.png", &err);
gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, NULL, 0);

win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_app_paintable(GTK_WIDGET(win), GTK_TRUE);
gdk_window_set_back_pixmap(window->window, pixmap, GTK_FALSE);


# A literal PyGTK equivalent

pixbuf = gtk.gdk.pixbuf_new_from_file('image.png')
pixmap = pb.render_pixmap_and_mask()
del pixbuf

win = gtk.Window()
win.window.set_back_pixmap(pixmap, gtk.FALSE)
del pixmap

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]