[pygtk] How to write a python plugin ?

Johan Dahlin jdahlin at async.com.br
Tue May 8 20:17:45 WST 2007


Sébastien Granjoux wrote:
> Hi All,
>
> I have a C program using GTK which is already able to load C plugin 
> using GModule and GTypeModule of glib.
>
> Basically, I'm reading an ascii file to know what is the name of the 
> type implemented in the plugin library. It should derivate from a 
> common Plugin type. I'm calling a registration function in the plugin 
> library to register this new type using g_type_module_register_type. 
> Then, I can create new object of this type as needed.
>
> The Plugin type has an activate and deactivate virtual method that 
> must be implemented in the plugin code.
>
>
> I have tried several ways to do this for a plugin written in python 
> but I haven't found any solution yet.
>
You should try looking at the gedit python plugin, which is very similar 
to what you want.
Note that your python plugin (in C) needs to implement all possible 
methods (activate etc) and call the real python plugins method (which 
are written in python).

Johan


More information about the pygtk mailing list