Yes, you were right, thank you. 

The solution was to add a connector and to draw the line after showing the 
window:
...
builder->get_widget("mainwindow")->show_all();

win = builder->get_widget("drawingarea");      // A DrawingArea from a glade 
file
gc = GTK2.GdkGC(win);
win->set_background(GTK2.GdkColor(255, 0, 0));      // It's ok, the background 
will be red
gc->set_foreground(GTK2.GdkColor(0, 0, 255));
win->signal_connect("expose-event", lambda() {
       win->draw_line(gc, 1, 1, 100, 100);                // It draws a blue 
line :) :) :)
});
...

Cheers:
Thomas

> From: [email protected]
> Subject: GTK2 DrawingArea question
> To: [email protected]
> Date: Sun, 2 May 2010 16:15:03 +0000
> 
> You probably need to draw the line _after_ the window is shown.
> Windows in X normally don't have backingstore, so you need to redraw
> their contents whenever a previously invisible region becomes
> visible.  I imagine there is some signal you should connect to your
> draw function to have it called whenever needed.
                                          
_________________________________________________________________
Menet közben használható e-mail és egyéb funkciók. Töltse le ingyen a Windows 
Live Hotmail programot.
https://signup.live.com/signup.aspx?id=60969
  • GTK... Csürke Tamás
    • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
      • ... Csürke Tamás

Reply via email to