I'm trying to develope my application with Pike and GTK, but when I used
GTK.DrawingArea to draw a line, it doesn't work.
I'm not sure if I misused GTK.DrawingArea, because I can't find example
program that also use DrawingArea
Error message and my code listed below, any suggestion?
It says:
Gdk-CRITICAL **: file gdkgc.c: line 51 (gdk_gc_new_with_values):
assertion `window != NULL' failed.
Gdk-CRITICAL **: file gdkgc.c: line 456 (gdk_gc_set_foreground):
assertion `gc != NULL' failed.
Gdk-CRITICAL **: file gdkdraw.c: line 65 (gdk_draw_line): assertion
`drawable != NULL' failed.
Here is my code:
#!/usr/bin/pike
int main ()
{
GTK.setup_gtk();
GTK.Window MainWin = 0;
GTK.Widget w = GTK.DrawingArea()->set_usize(100,100);
GDK.GC gc = GDK.GC(w)->set_foreground( GDK.Color(255,0,0) );
w->draw_line ( gc , 10 , 10 , 100 , 100 );
MainWin = GTK.Window ( GTK.WINDOW_TOPLEVEL );
MainWin->set_title ( "Testing" );
MainWin->add ( w );
MainWin->show_all();
GTK.main();
return 0;
}