### Method

# Gtk DrawingArea set_draw_func

#### Declaration [src]

    void
    gtk_drawing_area_set_draw_func (
      GtkDrawingArea* self,
      GtkDrawingAreaDrawFunc draw_func,
      gpointer user_data,
      GDestroyNotify destroy
    )

#### Description [src]

Setting a draw function is the main thing you want to do when using a drawing area.

The draw function is called whenever GTK needs to draw the contents of the drawing area to the screen.

The draw function will be called during the drawing stage of GTK. In the drawing stage it is not allowed to change properties of any GTK widgets or call any functions that would cause any properties to be changed. You should restrict yourself exclusively to drawing your contents in the draw function.

If what you are drawing does change, call `gtk_widget_queue_draw()` on the drawing area. This will cause a redraw and will call `draw_func` again.

#### Parameters

`draw_func`

  Type: `GtkDrawingAreaDrawFunc`

  Callback that lets you draw the drawing area’s contents.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  User data passed to `draw_func`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`destroy`

  Type: `GDestroyNotify`

  Destroy notifier for `user_data`.