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

Re: Window backround not showing



Hello.

You need to tell gtk that your window can be painted from within you
application. Just put this line of code:
gtk_widget_set_app_paintable( window, TRUE );
somewhere before gtk_widget_show function call and you should get your
application background painted.


2008/12/9 Bill Czermak <czermak netspace net au>:
> Am trying to set image as a backround for a window.  It flashes in the
> window and disappears.
> Running Fedora9 with latest patches
>
> Cutdown source shows problem:
>
> #include <gtk/gtk.h>
>
> static GtkWidget *entry;
> static    GtkWidget *window,*label,*vbox,*hbox,*button,*seperator;
> static GdkPixbuf *pixBuf;
> static GdkPixmap *pixMap;
> static GdkBitmap *pixMask;
>
> void PrintByeAndExit(GtkWidget *widget, gpointer data){
>   gtk_exit(0);}
>
>
> void setupGui(){
>   gtk_window_set_resizable(GTK_WINDOW(window),TRUE);
>   gtk_window_resize(GTK_WINDOW(window),500,400);
>
> gtk_signal_connect(GTK_OBJECT(window),"destroy",GTK_SIGNAL_FUNC(PrintByeAndExit),NULL);
>   gtk_window_set_title(GTK_WINDOW(window),"START MENU");
>   gtk_container_border_width(GTK_CONTAINER(window),5);
>
>   pixBuf=gdk_pixbuf_new_from_file("MIlogo.jpg",NULL);
>   gdk_pixbuf_render_pixmap_and_mask(pixBuf,&pixMap,&pixMask,0);
>   gtk_widget_show(window);
>   gdk_window_set_back_pixmap(window->window,pixMap,FALSE);
>   }
>
> int main(int argc, char *argv[]){
>   gtk_init(&argc,&argv);
>   window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
>   setupGui();
>   gtk_widget_show_all(window);
>   gtk_main();
>   return 0;}
>
> I guess I am missing something.  Any help appreciated
>
> Rgds Bill C
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



-- 
Tadej Borovšak
tadeboro gmail com
tadej borovsak gmail com


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