[PyKDE] KPanelApplet using Python

Jim Bublitz jbublitz at nwinternet.com
Fri Feb 24 21:40:11 GMT 2006


On Friday 24 February 2006 12:22, Varun Hiremath wrote:
> Hi,
> Can anyone give me an example on how to use pyKDE's KPanelApplet class to
>  make a KDE Panel Applet. I have made a small window using KMainWindow
>  and I have linked it to KPanelApplet class but it doesn't seem to work.
>  Here is the code: appName = "template"
>     app = KApplication (sys.argv, appName)
>     window = MainWin(None,"main window")
>     AppletWin = KPanelApplet("Applet", KPanelApplet.Normal , 0, window)
>     AppletWin.show()
>     app.exec_loop()
>
> Can I get some help.

For kicker to load a KPanelApplet, you need to have:

a. A .desktop file that kicker can find to put the applet in kicker's menu and 
make it loadable

b. .so and .la libs for the applet that kicker can load.

c. The .so lib needs a factory function that kicker can run to instantiate the 
applet.

To accomplish that with the applet written in Python, you need to provide 
a .so and .la lib as in (b), but they need to know how to load the Python 
script and call the (Python) factory function.

There was code to do that in older PyKDE versions, but it was pulled out due 
to maintenance problems mostly. I do have code that will create everything 
you need (except actually writing the applet in Python) and install it 
correctly, but it's part of an unfinished project for PyKDE extensions that 
isn't working completely - the panel applet part works fine though.

I can send you a copy if you're interested. It includes some documentation on 
how to write the applet.

Jim




More information about the PyQt mailing list