Re: jpg or png in gtk_window background?
- From: John K Luebs <jkluebs luebsphoto com>
- To: Markus Wolters <markuswolters gmx de>
- Cc: "gtk-app-devel gnome org" <gtk-app-devel-list gnome org>
- Subject: Re: jpg or png in gtk_window background?
- Date: Sat, 22 Feb 2003 17:32:06 -0500
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);
g_object_unref(pixbuf);
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_app_paintable(GTK_WIDGET(win), GTK_TRUE);
gtk_widget_realize(GTK_WIDGET(win));
gdk_window_set_back_pixmap(window->window, pixmap, GTK_FALSE);
g_object_unref(pixmap);
# 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.set_app_paintable(gtk.TRUE)
win.realize()
win.window.set_back_pixmap(pixmap, gtk.FALSE)
del pixmap
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]