dennogumi/content/post/2010-01-13-learning-by-example.markdown
Luca Beltrame 64b24842b8
All checks were successful
continuous-integration/drone/push Build is passing
Update all posts to not show the header text
2021-01-13 00:05:30 +01:00

30 lines
1.9 KiB
Markdown

---
author: einar
categories:
- KDE
- Linux
comments: true
date: "2010-01-13T21:37:38Z"
slug: learning-by-example
tags:
- KDE
- pykde
- python
title: Learning by example
omit_header_text: true
disable_share: true
wordpress_id: 744
---
With my brand-new SVN account, [I just committed some code](http://lists.kde.org/?l=kde-commits&m=126342017923323&w=2) to kdeexamples, KDE's example code module. In particular, I committed a simple example which shows how to use KConfigXT via PyKDE4, a simplified version of [what I wrote about here]({{ site.url }}/2009/10/howto-kconfigxt-with-pykde4).
As most of KDE is C++, and the Python API docs are translated directly from the C++ API docs, it is essential to have good examples to help newcomers learn faster. There are some PyKDE4 examples in the kdebindings module already, but I put mine in kdeexamples for a number of reasons:
* _Clear purpose_: kdeexamples is meant exactly for this - example code;
* _Visibility:_ A central place to find KDE examples even for bindings is optimal, makes easier to find what one is looking for.
Visibility is also important as currently the examples are rather buried inside kdebindings, and as far as I know they aren't included in the packages of some distributions (at least not openSUSE; YMMV).
I decided to take this route because PyKDE4 is basically the job of one person (Simon Edwards): he does already a great job, but the work is too much for a single person to handle. And due to shortage of human resources, PyKDE4 lacks examples and documentation, and thus it's not always easy to understand how to use the C++ API in Python. Writing snippets of working code, with extensive comments, is a step in the good direction. And also an opportunity to contribute back to KDE after all these years!
For now there's just KConfigXT, but I plan on tackling KIO next, as soon as I have time. Of course, help is welcome!