2005-08-04 21:27

Not letting stuff fall off the ' net

For a bunch of apps I write, I often want to be able to add a systray icon.

But... I write them using PyQt, and the systray stuff is in PyKDE.

But... Torsten Marek did write a module to do that. The only problem for me is the python-ctypes requirement, but it's no big deal for my apps that are not massively deployed.

You can find his code, in a somewhat mangled form, here

And since building extension modules is not completely trivial, here's a simple setup.py that will do it:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from distutils.core import setup
from distutils.extension import Extension

  name = "systray",
    Extension('traywin', ['traywin.c'],  libraries=["X11"],library_dirs=['/usr/X11R6/lib'])],

Put it in the same folder with his code, then you can do python setup.py install or somesuch, then you can use it in your app like in Torsten's systray2.py example, and it will work.


Comments powered by Disqus

Contents © 2000-2019 Roberto Alsina