How one can start learning PyKDE ?

Wednesday, April 1st, 2009 | FOSS, KDE, Python, problem

Dear lazyweb,

How one can start learning PyKDE ? For PyQt , reading a few very basic examples given with the source and then reading Qt-help docs seems to be fine. But the KDE libs are much bigger, though one can find a suitable class to work with, how to use that is still not so easy for a newbie.

When it comes to the GUI, it is again not clear to me that which approach one should take , design everything in code ? or one can use qt-designer for that.

Kushal

Tags: , , , ,

4 Comments to How one can start learning PyKDE ?

Luca Beltrame
April 1, 2009

AFAIK there are a few small tutorials in PyKDE, but for the rest you’ll have to study the C++ API.

Andras
April 1, 2009

Create your first application GUI from code to learn how it works and use later Qt Designer.

Will Stephenson
April 1, 2009

I just wrote my first PyKDE4 app, a tool for backporting branch fixes to packages. Although I consider myself an experienced KDE C++ developer, I was in some ways a newbie because most of what I do is working on existing code or writing libraries, not breaking new ground (and I haven’t used Python for years).

When working with PyKDE4, I found the PyQt documentation sufficient to learn the syntax and common idioms (QtCore.QObject.connect(), strings vs QString). I used the TechBase KDE C++ tutorials and the pythonized versions of the KDE4.2 API docs to put together my app – which uses KConfigXT for saving settings, KXmlGuiWindow for menus and toolbars, and a number of Designer-created widgets for the UI itself, so it proved to me that you can write a full-blooded KDE app in Python, not just a hack or a toy. (There are many more prominent examples of full PyKDE apps, see techbase links)

I think working through the c++ tutorials using PyKDE will give you a good overview of which-class-does-what. When you find an area that isn’t covered, shout about it and we’ll make more tutorials.

For the UI question, you can of course hand-code, but using Designer is normal. You can generate a Python script statically from the designer .ui, as is commonly done in c++ KDE, but most of the examples I saw generate the UI at runtime from the .ui. I think that this is because a) there isn’t any CMake infrastructure for generating .py from .ui with pyuic4 and b) you need to use pykdeuic4.py instead of pyuic4 if your .ui uses KDE instead of pure Qt widgets, otherwise the import statements for those widgets in the generated .py is broken. At the moment, I am running pykdeuic4.py foo.ui > foo.py by hand and committing the generated files…

Useful links:
PyQt4 overview: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html
PyQt4 api docs: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html
PyKDE4 api docs: http://api.kde.org/pykde-4.2-api/
PyKDE4 overview (more links!): http://techbase.kde.org/Development/Languages/Python
KDE tutorials. Working through the ‘Introduction to KDE 4 Programming’ tutorials should get you started: http://techbase.kde.org/Development/Tutorials

aamod
April 7, 2009

I also faced the same problem when I wanted to try PyKDE.

Their is no documentation anywhere on techbase. Just “svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebindings/python/pykde4
” or via websvn “http://websvn.kde.org/trunk/KDE/kdebindings/python/pykde4/”

The documentation and examples are in docs/ and examples/ directory respectively.

Hope this is good for your needs..

In PyKDE, the Q’s in PyQt become K’s.. ;-)

Leave a comment

Search

Archives

Categories