PyKDE Programming/KDE

The Structure of a KDE ApplicationEdit

A basic KApplicationEdit

Every KDE application you are going to write from now on will contain most of the following code.

import sys
from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData
from PyKDE4.kdeui   import KApplication
appName     = "kde-application"
catalog     = "simple test"
programName = ki18n("KDE Application")
version     = "1.0"
aboutData = KAboutData(appName, catalog, programName, version)
KCmdLineArgs.init (sys.argv, aboutData)
app = KApplication ()
# your main widget (the application window) would be created and shown here

Go ahead, run this file. The program will load and will not end until you terminate it.

Next we will learn how to add a first widget.

Last modified on 16 October 2010, at 00:33