Python and Clutter Introduction/Tutorial

  • Colors
  • Your First Actor

Check out for the most up to date version.

The best way to describe clutter is to quote its home page which states:

Clutter is an open source software library for creating fast, visually rich and animate graphical user interfaces.

Clutter can be integrated with many Linux technologies including GStreamer, Cairo a GTK+. It also is portable and runs on Windows and OSX, which allows for cross platform goodness.

But how is clutter used? This is actually very simple. Instead of creating a gtk.Window as in using PyGTK, with clutter, a clutter.Stage is created. And instead of using widgets, Actors are used. This is actually rather neat. We have Stages to do the work on with Actors that perform.

Some base Actors included with clutter are:

  • Label - displaying Labels
  • Rectangle - For creating Rectangles
  • Entry - For entering text

A stage is created by using the clutter.Stage object like so:     stage = clutter.Stage()

The size of stage can be set:     stage.set_size(800, 400)

The title of the stage can be set using the stage.set_title() method:     stage.set_title(“Hey Hey, My First Clutter App”)


The colour of a stage can be set using set_color() method and using the clutter.color_parse() method. The clutter parse method can take several different colour inputs including the colours as Text or HTML Notation.

The colour of a stage can be set:

    stage.set_color(clutter.color_parse(“red”))     stage.set_color(clutter.color(“#FF0000”))

Or the colour may be set directly using the clutter.Color() using RGB colors.     stage.set_color(clutter.Color(255, 0, 0))

Colours can not just be applied to a stage as has been shown here but may also be applied to all the Actors that will be shown in the next section.

Your First Actor

The clutter.Label Actor allows the programmer to put text labels anywhere on the stage. These are useful to display information to the user of the program. A small example of labels changing the font type and size of the letters. If no position is set it will default to placing the labels in the upper most left corner.

import clutter

stage = clutter.Stage()
stage.set_size(400, 400)

label = clutter.Label()
label.set_text("Clutter Label Text")
# If no position is given it defaults to the upper most left corner.



Thats it for now. In the next installment I will cover basic animations.