1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Writing an applet in languages other than C</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7
<link rel="home" href="index.html" title="Panel Applet Library Reference Manual">
8
<link rel="up" href="getting-started.html" title="Part II. Getting Started with the Panel Applet library">
9
<link rel="prev" href="getting-started.in-out-process.html" title="Out-of-Process vs In-Process">
10
<link rel="next" href="port-gnome2.html" title="Part III. Porting Applets from GNOME 2.x">
11
<meta name="generator" content="GTK-Doc V1.17.1 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
16
<td><a accesskey="p" href="getting-started.in-out-process.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
17
<td><a accesskey="u" href="getting-started.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
18
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19
<th width="100%" align="center">Panel Applet Library Reference Manual</th>
20
<td><a accesskey="n" href="port-gnome2.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23
<div class="titlepage"><div><div><h2 class="title">
24
<a name="getting-started.introspection"></a>Writing an applet in languages other than C</h2></div></div></div>
26
The Panel Applet library comes with support for <a class="ulink" href="http://live.gnome.org/GObjectIntrospection" target="_top">GObject Introspection</a>. This makes it possible to write applets in the languages that have <a class="ulink" href="http://live.gnome.org/GObjectIntrospection/Users" target="_top">bindings based on GObject Introspection</a>.
29
Here is a simple example of a python applet:
33
<a name="id2579553"></a><p class="title"><b>Example 4. Hello World applet, in Python</b></p>
34
<div class="example-contents">
35
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
38
<td class="listing_lines" align="right"><pre>1
57
<td class="listing_code"><pre class="programlisting">from gi.repository import Gtk
58
from gi.repository import PanelApplet
60
def applet_fill(applet):
61
label = Gtk.Label(<span class="number">"Hello World"</span>)
65
def applet_factory(applet, iid, data):
66
<span class="keyword">if</span> iid != <span class="number">"HelloWorldApplet"</span>:
67
<span class="keyword">return</span> False
71
<span class="keyword">return</span> True
73
PanelApplet.Applet.factory_main(<span class="number">"HelloWorldFactory"</span>,
74
PanelApplet.Applet.__gtype__,
75
applet_factory, None)</pre></td>
82
<p><br class="example-break">
85
The only limitation of writing an applet in a language other than C is that the applet will not be able to run in the panel process: it will have to stay out-of-process. However, since it is recommended to leave applets out-of-process, this limitation is mitigated.
90
Generated by GTK-Doc V1.17.1</div>
b'\\ No newline at end of file'