|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN
|
|
|
|
"http://www.w3.org/TR/html4/loose.dtd"">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Examples</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
|
|
<meta name="GENERATOR" content="Quanta Plus">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<DIV
|
|
|
|
CLASS="NAVHEADER"
|
|
|
|
><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
|
|
|
<TR><TH COLSPAN="3" ALIGN="center">Python Bindings for KDE (PyKDE-3.16.0)</TH></TR>
|
|
|
|
<TR><TD WIDTH="10%" ALIGN="left" VALIGN="bottom"><A HREF="switches.html" ACCESSKEY="P">Prev</A></TD>
|
|
|
|
<TD WIDTH="80%" ALIGN="center" VALIGN="bottom"></TD>
|
|
|
|
<TD WIDTH="10%" ALIGN="right" VALIGN="bottom"><A HREF="dcopext.html" ACCESSKEY="N">Next</A></TD>
|
|
|
|
</TR>
|
|
|
|
</TABLE><HR ALIGN="LEFT" WIDTH="100%"></DIV>
|
|
|
|
<h1>Templates and Example programs</h1>
|
|
|
|
<h2>Templates</h2>
|
|
|
|
<p>
|
|
|
|
PyKDE includes a number of examples or "templates" that you can use as frameworks for
|
|
|
|
building your own apps or experimenting with PyKDE. The templates are executable
|
|
|
|
programs which usually construct an application with a main window, and in some cases
|
|
|
|
with menus, toolbar and status bar, but have no other functionality. You can use these
|
|
|
|
to get a tquick start on creating a program, for exploring PyKDE, or for testing various
|
|
|
|
ideas using PyKDE.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
There are a number of template examples in the templates/ subdirectory. The same
|
|
|
|
files a duplicated in templates/annotated/ and templates/basic/. The files in
|
|
|
|
annotated/ have extensive comments, the files in basic/ have the comments stripped
|
|
|
|
to make the templates easier to use in constructing your own programs.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
The current set of templates provide basic applications using different UI construction
|
|
|
|
strategies, an panel applet template, and a systray program template.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2>Examples</h2>
|
|
|
|
<p>
|
|
|
|
Example programs are located in the examples/ directory (contributions are always welcome).
|
|
|
|
All examples are run as "python <example name>.py", eg "python uisampler.py".
|
|
|
|
</p>
|
|
|
|
<h2>uisampler.py</h2>
|
|
|
|
<p>
|
|
|
|
uisampler.py demonstrates a number of widgets and UI features of PyKDE.
|
|
|
|
</p>
|
|
|
|
<img src="images/uisampler.png" border=0>
|
|
|
|
<p>
|
|
|
|
For widgets, the panel on the right displays sample widgets. The widgets or other items for
|
|
|
|
display are selected from the tree view on the left. A number of the examples are UI related
|
|
|
|
items like KAction, KXMLGUI releated things, etc.These use either menudemo.py or xmlmenudemo.py
|
|
|
|
to display examples of usage.
|
|
|
|
</p>
|
|
|
|
<h3>menudemo.py</h3>
|
|
|
|
<p>
|
|
|
|
menudemo.py is a simple menu based example "application" that does nothing, but displays
|
|
|
|
a UI (toolbar, status bar, menus) constructed using KAction and related classes. It runs
|
|
|
|
as part of uisampler.py or will run stand-alone.
|
|
|
|
</p>
|
|
|
|
<h3>xmlmenudemo.py</h3>
|
|
|
|
<p>
|
|
|
|
xmlmenudemo.py is a simple menu based example "application" that does nothing, but displays
|
|
|
|
a UI (toolbar, status bar, menus) constructed using an XML 'desktop' file. It runs
|
|
|
|
as part of uisampler.py or will run stand-alone.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2>kurldemo.py</h2>
|
|
|
|
<p>
|
|
|
|
kurldemo.py displays the results of a number of KURL and KURL.List operations in a window.
|
|
|
|
It's probably more instructive to look at the code for this example then to actually run
|
|
|
|
it, but it is working code.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2>mimetype.py</h2>
|
|
|
|
<p>
|
|
|
|
mimetype.py displays several tabs of KMimeType/KService/TDETrader related data
|
|
|
|
</p>
|
|
|
|
<img src="images/mimetype.png" border=0>
|
|
|
|
<p>
|
|
|
|
The output will vary with KDE version running or from machine to machine.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<h2>pyTDEHTMLPart.py</h2>
|
|
|
|
<p>
|
|
|
|
pyTDEHTMLPart.py demonstrates importing TDEHTMLPart as a KPart.
|
|
|
|
</p>
|
|
|
|
<img src="images/tdehtmlpart.png" border=0>
|
|
|
|
<p>
|
|
|
|
The program is hard-coded to display the KDE website's main page, and requires
|
|
|
|
an active internet connection to do the display (it will be blank if no internet
|
|
|
|
connection is active).
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
The program is not designed as a complete browser example, and none of the links
|
|
|
|
are "clickable" (it wouldn't be hard to extend it to do this however - see the
|
|
|
|
TDEHTMLPart docs).
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2>systray.py</h2>
|
|
|
|
<p>
|
|
|
|
systray.py is a simple example of a system tray based application.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<DIV CLASS="NAVFOOTER">
|
|
|
|
<HR ALIGN="LEFT" WIDTH="100%">
|
|
|
|
<TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" >
|
|
|
|
<TR>
|
|
|
|
<TD WIDTH="33%" ALIGN="left" VALIGN="top"><A HREF="switches.html" ACCESSKEY="P">Prev</A></TD>
|
|
|
|
<TD WIDTH="34%" ALIGN="center" VALIGN="top"><A HREF="index.html" ACCESSKEY="H">Home</A></TD>
|
|
|
|
<TD WIDTH="33%" ALIGN="right" VALIGN="top"><A HREF="dcopext.html" ACCESSKEY="N">Next</A></TD>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD WIDTH="33%" ALIGN="left" VALIGN="top">configure.py Options</TD>
|
|
|
|
<TD WIDTH="34%" ALIGN="center" VALIGN="top"> </TD>
|
|
|
|
<TD WIDTH="33%" ALIGN="right" VALIGN="top">DCOP and Extensions</TD>
|
|
|
|
</TR>
|
|
|
|
</TABLE>
|
|
|
|
</DIV>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|