A simple clock implemented in pygtk and cairo

Ralph Glass


Table of Contents

Introduction
Prerequisites
Usage
Acknowledgement
Where to get it from

Introduction

This is a very simple clock that was written because i wanted to learn about cairo and pygtk.

I used the gobject.timeout_add() function to implement a timer. This timer is needed to update the clock widget when the pointers change position. Else the clock would not be updated until an expose event (widget redraw) occurs.

Prerequisites

Make sure you have installed pygtk (>=2.7.99) with cairo. I personally use Ubuntu 5.10 where recent packages are available.

Usage

Click on the widget to toggle the window decorations on and off.

Acknowledgement

I used the examples by Øyvind Kolås on the cairo website and the pygtk widget example from gnome CVS as a starting point.

Where to get it from

Download the python code: clock.py

Visit the website