Re: can anybody help with bebugging a little displaying program?



the run time  error is:

i olympia GTK]$ ./a.out

** CRITICAL **: file gdk-pixbuf-render.c: line 205 (gdk_pixbuf_render_to_drawable): assertion `drawable != NULL' failed.
[gli olympia GTK]$


#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

void delete_event( GtkWidget *widget,
		   GdkEvent  *event,
		   gpointer   data )
{
 gtk_main_quit ();
}

int main( int   argc,char *argv[] )
                {
                    GtkWidget *window;
                    GdkPixbuf *pixbuf;
                    GtkWidget *widget;

                    gtk_init (&argc, &argv);

                    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
		     GTK_SIGNAL_FUNC (delete_event), NULL);
		     widget = gtk_event_box_new();
gtk_window_set_title (GTK_WINDOW (window),"hello!!guo guo"); gtk_container_set_border_width (GTK_CONTAINER (window), 200);

                    pixbuf = gdk_pixbuf_new_from_file("rose");
gtk_widget_set_usize(widget, gdk_pixbuf_get_width(pixbuf),gdk_pixbuf_get_height(pixbuf)); gdk_pixbuf_render_to_drawable (pixbuf, widget->window,widget->style->white_gc, 0, 0,0,0, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), GDK_RGB_DITHER_NORMAL, 0, 0);


                    gtk_container_add(GTK_CONTAINER(window), widget);

                    gtk_widget_show(widget);
                    gtk_widget_show  (window);
                    gtk_main ();
                    return 0;
                }


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




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