TDE programming language bindings
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.4 KiB

PYTHON bindings for DCOP

These are the new-style Python DCOP bindings. The way in which the bindings are
implemented has changed since KDE 3.1.1.

How they work

The code is divided into two parts:

pcop.cpp - the C++ interface between Python and DCOP - generates shared library
which can be imported by Python - the Python interface to pcop.cpp

pcop.cpp includes a header file marshal_funcs.h, which is generated from
a data file called by a converter script, contains the basic code necessary to marshal and demarshal the different
types that DCOP can handle. For example, it codes how to convert a TQString for use by Python
(in this case, a Python string) and the reverse - what the user may supply in Python when
DCOP requires a TQString. In addition to the fundemental types, more complex QT classes are
coded, such as TQRect (which converts to a Python tuple ( (x1,y1), (x2,y2) ) ).

Documentation is auto-generated out of, creating file marshal_funcs_doc.html,
which details how each DCOP type (e.g. TQString, TQRect, int, QCStringList) is represented in Python.

In this implementation, each DCOP type is represented by a basic Python type - numeric, tuple, etc.
There are no "QT bindings" necessary.

These bindings allow you to code Python to act as a DCOP client (querying and/or controlling
other DCOP applications), or as a DCOP server. This means that you can DCOP-enable Python applications
even if they are not QT based.

If you want to use DCOP in the context of a Python QT application, then there are DCOP bindings included in
the PyQT and PyKDE bindings available from:


There are some example Python programs in the test directory.

Known problems

There is currently a bug which means you must import both pcop and pydcop in your Python programs.
This means that a Python program using dcoppython must include:

import pcop
import pydcop

In that order. If you don't import pcop, a seg fault occurs when the interpreter exits. This, of course, will be
fixed once I find out what the hell's going on.


The original Python DCOP bindings were written by Torben Weis (
The current implementation, based on Torben's worked, was written by Julian Rockey (
Julian is also the current maintainer.