gramplet = 'init',
=== Explanation ===
The main work of a Gramplet is performed in a function, or a class. In this very simple example, a function
'''init ''' is defined that takes a single argument, gui. The function simply sets the gui's text area to be "Hello World!", and that's it. It does this just once, and never changes.
Before a plugin can be used, it needs to be "registered". You call the register function with a number of named-arguments. There are a number of named-arguments that you can provide, including: name, height, content, title, expand, state, and data. We will explore those in detail, below.
== GUI Interface ==
Occasionally, you might have to dive down to the graphical objects that compose a Gramplet.
If you wanted to put an arbitrary gtk object into the main area of a Gramplet, then you need to replace the standard textview object with your own. Here is the basic structure:
# File: Widget.py
===Cairo Clock Example===
[[File:ClockGramplet-addon-example-50.png|thumb|400px|right|Clock Gramplet - shown detached (Gramps 5.0.0)]]
In fact, with Python,
gtk, and cairo, you can make your own widgets that do pretty much anything and look very nice.
Here is an example adding a Cairo Clock (which really keeps time)
with GTK 2 & Gramps 3. 4: [https:// gramps-addons. svn.sourceforge.net/svnroot/gramps-addons/ branches/ gramps34/ download/ClockGramplet .addon.tgz ClockGramplet .addon.tgz]* or with GTK+3 & Gramps 4.2: [https://github.com/gramps-project/addons/blob/master/ gramps50/download/ClockGramplet.addon.tgz?raw=true ClockGramplet.addon.tgz]