Posts


Check out http://majorsilence.com/pygtk_book 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”)

Colors

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.

stage.add(label)
stage.show_all()

clutter.main()

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


I have spent a few hours the last couple of days doing some work on the zenphoto uploader I found a few days ago. I now consider the work I did on it to be good enough to use.

The source can be downloaded http://files.majorsilence.com/apps/zpu/zpu-0.3A2.zip or the diffs to version 2 can be found at http://files.majorsilence.com/apps/zpu/zpu2.diff and http://files.majorsilence.com/apps/zpu/zpu2_glade.diff.

Some of the differences from version 2 are I have changed the GUI a bit. Added the ability to create a new album. Added the ability to preview image que.

These changes have not been accepted into the main zpu (not yet at least) but I will be creating a Windows installer package and page to go along with it at http://www.majorsilence.com/zpu.


I found an interesting new program yesterday. It is zpu (ZenPhoto Uploader). It is exactly what I was looking for. It allows you to upload entire directories of photos without having to do it manually with the webform. I know it can be down by ftp but I am using an easy one click install from dreamhost for simplicity and it only supports the web form upload process.

So zpu saved the day for me. I had to make a few changes to make it work on Windows; they have since been included to become 0.2.

I also am working on some GUI changes to make it nicer to work with. Hopefully they will get included as well.