On Saturday 07 October 2006 14:59, DarkBlue wrote:

> In linux I use kmail as my email client under KDE,
> if a message comes in the Kontact button in the
> taskbar changes to blue.
> How can I have the same behaviour in a python app ?

You need to activate the window associated with the application.

> I have a python script which runs nicely under linux
> now every so often I want to be notified by some event,
> in this case that a record has been added to a database
> and I want to have the application button in the taskbar
> to change color

If the script is running in a console, you'll need to activate
the window containing the console. I tried doing this by accessing
konsole's DCOP interface, but couldn't find a suitable method to
call. If you know which konsole your script is running in, you might
find that you can raise the window with

  dcop konsole-<pid> konsole-mainwindow#1 raise

where <pid> is the process ID of the konsole. This might have the
effect of causing its taskbar button to change color. You can find
information about the konsole from the KONSOLE_* environment
variables.

It would be good if konsole had a DCOP method that enabled you to
activate its window, or if kicker exported an interface for the
taskbar, or even if kwin had some way of letting you activate a
window given its ID. Unfortunately, I couldn't find methods for
any of these, so you would have to think about using PyKDE to get
at this functionality.

It would be good if someone could prove me wrong on any of this. ;-)

David
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to