Also note that you can't create a GC from a widget before it's realized, so you need to defer that call. This code works, for example:
#!/usr/bin/pike
int main () { GTK.setup_gtk();
GTK.Window MainWin = 0;
GTK.Widget w = GTK.DrawingArea()->set_usize(100,100); GDK.GC gc; w->signal_connect("expose_event", lambda() { if(!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; }