Re: how to draw using GtkDrawingArea?



Aaron Phillips wrote:

Hello I'm new to Gtk and need a bit of direction on how to draw (as to a
canvas) in Gtk.  The track I'm on now is to use GtkDrawingArea with Gdk
primitives.  I am having trouble with this.  I am trying to respond to a
GtkImageMenuItem "activate" event by drawing a figure to the drawing
area.  Here is the line that does this:
        gdk_draw_arc (drawingarea->window,
                        drawingarea->style->fg_gc[GTK_WIDGET_STATE(drawingarea)],
                        TRUE,
5, 5, 10, 10, 0, 64 * 360);
The problem is nothing happens on the drawing area.  Is there some
refresh-type function I need to call or something, or am i totally on
the wrong track.

You need to implement an "expose_event" signal handler. Look at "scribble-simple" example
(it comes with gtk source) it shows how this can be implemented.

Olexiy





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