Sunday, 5 September 2021

Simple Drawing Functions Offered by GTK+3 and Cairo

The script shows how to draw simple shapes on a GTK+3 drawing area using Python3.

  


  1. Define a drawing area using Gtk.DrawingArea().
  2. Setting color using set_source_rgb().
  3. Drawing circles with arc().
  4. Moving the drawing tip with move_to().
  5. Drawing lines with line_to().
  6. Drawing rectangles with rectangle().
  7. Drawing the outline of a shape and filling the content of the shape with stoke() and fill() respectively.
  8. Setting the line width with set_line_width().
  9. Setting line dash with set_dash().

Reference

Basic Drawing in PyCairo

Source Code




No comments:

Post a Comment