<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.inkscape.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Blackhex</id>
	<title>Inkscape Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.inkscape.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Blackhex"/>
	<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/Special:Contributions/Blackhex"/>
	<updated>2026-04-30T13:38:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=User:Blackhex&amp;diff=14653</id>
		<title>User:Blackhex</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=User:Blackhex&amp;diff=14653"/>
		<updated>2007-05-18T23:20:07Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: Creating personal page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Name: Radek Bartoň&amp;lt;br/&amp;gt;&lt;br /&gt;
Nationality: Czech&amp;lt;br/&amp;gt;&lt;br /&gt;
Timezone: +1 GMT&amp;lt;br/&amp;gt;&lt;br /&gt;
Home Page: http://blackhex.no-ip.org&amp;lt;br/&amp;gt;&lt;br /&gt;
E-Mail: blackhex@post.cz&amp;lt;br/&amp;gt;&lt;br /&gt;
Jabber: blackhex@jabber.cz&amp;lt;br/&amp;gt;&lt;br /&gt;
Occupation: Master degree student at Brno University of Technology&amp;lt;br/&amp;gt;&lt;br /&gt;
Wiki Contribution:&amp;lt;br/&amp;gt;&lt;br /&gt;
* [[PythonEffectTutorial]]&lt;br /&gt;
Inkscape Contribution:&amp;lt;br/&amp;gt;&lt;br /&gt;
* not yet&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=Script_extensions&amp;diff=14651</id>
		<title>Script extensions</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=Script_extensions&amp;diff=14651"/>
		<updated>2007-05-18T23:07:31Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: Added reference to PythonEffecttutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[Note: This page concerns using scripting languages to create new Inkscape functionality.  To access Inkscape functionality from scripting languages (i.e. to script Inkscape), see the Inkscape man page (especially in the development version or v0.46 or later, which provide --select and --verb options), or see the work in the src/extension/script directory of Inkscape source.]&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
Inkscape provides the ability for its functionality to be extended using traditional unix scripts.  By this, we mean a program that takes in a stream of data through standard in, and then outputs that data on standard out.  This is a very easy way to expand Inkscape, and provide custom functionality, without learning the internals of Inkscape.  Plus, there are SVG read and writing libraries out there for almost any language, and the rest of them all have XML support (which is really what you probably want to use anyway).  This HOWTO discusses the ends and outs of writing one of these scripts and getting it to work with the Inkscape core functionality. &lt;br /&gt;
&lt;br /&gt;
=== Types of scripts ===&lt;br /&gt;
&lt;br /&gt;
There are three functions that added with a script:&lt;br /&gt;
&lt;br /&gt;
* Input, providing translation from a file format to SVG&lt;br /&gt;
* Output, providing translation from SVG to a format&lt;br /&gt;
* Effect, taking in SVG, changing it, and then outputing SVG&lt;br /&gt;
&lt;br /&gt;
While all of these are very similar in the scripting interface, there are slight differences between them.&lt;br /&gt;
&lt;br /&gt;
=== Interaction ===&lt;br /&gt;
&lt;br /&gt;
It is important for a script author to understand how Inkscape and scripts communicate.&lt;br /&gt;
&lt;br /&gt;
(interpreter)? your_script (--param=value)* /path/to/input[[/SVGfile]] | inkscape&lt;br /&gt;
&lt;br /&gt;
Inkscape runs your script (optionally with an interpreter) passing it any number of parameters in long gnu style. The final argument is the name of the temporary svg file your script should read. After processing, the script should return the modified svg file to inkscape on STDOUT.&lt;br /&gt;
&lt;br /&gt;
=== Important Tips ===&lt;br /&gt;
&lt;br /&gt;
* Receive the inkscape arguments.&lt;br /&gt;
* Clear temp files if it creates one.&lt;br /&gt;
* Write full changed SVG to the default output.&lt;br /&gt;
* Don't break an xml:space=&amp;quot;preserve&amp;quot; area.&lt;br /&gt;
* Send error text to the error output and help the user.&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
In order for Inkscape to make use of an external script or program, you must describe that script to inkscape using an INX file. See the inkscape share directory for examples. The INX file allows the author to:&lt;br /&gt;
* label strings for translation &lt;br /&gt;
* define parameters&lt;br /&gt;
* chain extensions&lt;br /&gt;
Please see [[MakingAnINX]] for help creating an INX file for your script.&lt;br /&gt;
&lt;br /&gt;
==== Parameters ====&lt;br /&gt;
The INX file describes which parameters the extension needs. Inkscape will prompt the user with a UI to fill out these parameters before the extension is called. Each parameter will be passed through the commandline as &amp;quot;--paramname=paramvalue&amp;quot;. Eg. if you have described a string parameter with name 'string1' in the INX file, Inkscape will present a textbox to the user. When the user fills in &amp;quot;text&amp;quot; and presses OK, it will pass '--string1=&amp;quot;text&amp;quot;' to the program specified by the &amp;lt;command&amp;gt; tag.&lt;br /&gt;
&lt;br /&gt;
There are several types of parameters that can be requested by the INX description:&lt;br /&gt;
&lt;br /&gt;
* Boolean&lt;br /&gt;
* Int&lt;br /&gt;
* Float&lt;br /&gt;
* String&lt;br /&gt;
* Description&lt;br /&gt;
* Enum&lt;br /&gt;
* Notebook&lt;br /&gt;
* Option group (radio buttons)&lt;br /&gt;
&lt;br /&gt;
=== Installing ===&lt;br /&gt;
&lt;br /&gt;
Installing is as simple as copying the script (unless it resides in your path) and its INX file to the inkscape/share/extensions (home/.inkscape/extensions) directory. (If you install a script in your home directory be sure to copy the dependencies.)&lt;br /&gt;
&lt;br /&gt;
If you are looking to use scripts that have already been written, the most difficult part will likely be the installation. Since scripts are  seperate programs they may have any number of dependencies that are not included with inkscape. Currently, the best way to find missing dependencies is by reading the error messages produced by running the script from the command line.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
&lt;br /&gt;
*[http://www.ekips.org/comp/inkscape/extending.php#ignorance| Aarons website] describing his path to learning how scripting extensions work. '''VERY OUT-OF-DATE'''&lt;br /&gt;
&lt;br /&gt;
*[[MakingAnINX]]&lt;br /&gt;
&lt;br /&gt;
*[[PythonEffectTutorial]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=INX_extension_descriptor_format&amp;diff=14479</id>
		<title>INX extension descriptor format</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=INX_extension_descriptor_format&amp;diff=14479"/>
		<updated>2007-05-03T19:30:28Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: Added missing item element&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
&lt;br /&gt;
In order for Inkscape to make use of an external script or program, you must describe that script to inkscape using an INX file. See the inkscape share directory for examples. The INX file allows the author to:&lt;br /&gt;
* label strings for translation &lt;br /&gt;
* define parameters&lt;br /&gt;
* chain extensions&lt;br /&gt;
* etc&lt;br /&gt;
Be sure to read through the INX files that come with Inkscape. Nothing beats a working example.&lt;br /&gt;
&lt;br /&gt;
== Localisation of extensions ==&lt;br /&gt;
&lt;br /&gt;
To allow localisation of strings in extension for Inkscape, some xml tags have to be adapted to variant readable by intltool. It means that tags or parametres has to have &amp;quot;_&amp;quot; prepended to their name, e.g. &amp;lt;_name&amp;gt;name of extension&amp;lt;/_name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also the path to the extension has to be included in POTFILES.in file to tell intltool where to look for translatable content.&lt;br /&gt;
&lt;br /&gt;
Usefull information, before this section gets fully updated, can be found at [http://gould.cx/ted/blog/Translating_Custom_XML Ted's blog].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
More example INX files are available in the Inkscape distribution or in the Inkscape [http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/|SVN repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;inkscape-extension&amp;gt;&lt;br /&gt;
  &amp;lt;_name&amp;gt;{Friendly Extension Name}&amp;lt;/_name&amp;gt;&lt;br /&gt;
  &amp;lt;id&amp;gt;{org.domain.sub-domain.extension-name}&amp;lt;/id&amp;gt;&lt;br /&gt;
  &amp;lt;dependency type=&amp;quot;executable&amp;quot; location=&amp;quot;[extensions|path|plugins|{location}]&amp;quot;&amp;gt;program.ext&amp;lt;/dependency&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;tab&amp;quot; type=&amp;quot;notebook&amp;quot;&amp;gt;  &lt;br /&gt;
    &amp;lt;page name=&amp;quot;controls&amp;quot; _gui-text=&amp;quot;Controls&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;param name=&amp;quot;{argumentName}&amp;quot; type=&amp;quot;[int|float|string|boolean|description]&amp;quot; min=&amp;quot;{number}&amp;quot; max=&amp;quot;{number}&amp;quot;&lt;br /&gt;
        _gui-text=&amp;quot;{Friendly Argument Name}&amp;quot;&amp;gt;{default value}&amp;lt;/param&amp;gt;&lt;br /&gt;
    &amp;lt;/page&amp;gt;&lt;br /&gt;
    &amp;lt;page name=&amp;quot;help&amp;quot; _gui-text=&amp;quot;Help&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;param name=&amp;quot;help_text&amp;quot; type=&amp;quot;description&amp;quot;&amp;gt;{Friendly Extension Help}&amp;lt;/param&amp;gt;&lt;br /&gt;
    &amp;lt;/page&amp;gt;&lt;br /&gt;
  &amp;lt;/param&amp;gt;&lt;br /&gt;
  &amp;lt;effect&amp;gt;&lt;br /&gt;
    &amp;lt;object-type&amp;gt;[all|{element type}]&amp;lt;/object-type&amp;gt;&lt;br /&gt;
      &amp;lt;effects-menu&amp;gt;&lt;br /&gt;
        &amp;lt;submenu _name=&amp;quot;{Extension Group Name}&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/effects-menu&amp;gt;&lt;br /&gt;
  &amp;lt;/effect&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;command reldir=&amp;quot;extensions&amp;quot; interpreter=&amp;quot;[python|perl|ruby|bash|{some other}]&amp;quot;&amp;gt;program.ext&amp;lt;/command&amp;gt;&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/inkscape-extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DTD ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT inkscape-extension (name, id, dependency*, param*,(input|output|effect),(script|plugin))&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT input (extension, mimetype, filetype, filetypetooltip, output_extension?)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT output (extension, mimetype, filetype, filetypetooltip, dataloss?)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT effect (object-type)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT script (command, helper_extension*, check*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT plugin (name)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT name (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT id (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT item (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT dependency (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT param (#PCDATA, page*, item*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT page (#PCDATA, param*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT extension (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT mimetype (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT filetype (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT filetooltip (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT object-type (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT command (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT check (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT dataloss (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT helper_extension (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT output_extension (#PCDATA)&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;!ATTLIST check reldir (absolute|path|extensions|plugins) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST command reldir (absolute|path|extensions|plugins) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST command interpreter CDATA #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST dependency type (executable|extension) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST dependency location (absolute|path|extensions|plugins) #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST dependency description CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST page name CDATA #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST page gui-text CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param name CDATA #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param type (int|float|string|boolean|enum|notebook|description) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param min CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param max CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param gui-text CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST submenu name CDATA #REQUIRED&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[[ScriptingHOWTO]]&lt;br /&gt;
*[http://sourceforge.net/mailarchive/message.php?msg_id=11420660|Aaron's message] from the developer list with an initial DTD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer Documentation]]&lt;br /&gt;
[[Category:Help Wanted]]&lt;br /&gt;
[[Category:Extensions]]&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=INX_extension_descriptor_format&amp;diff=14431</id>
		<title>INX extension descriptor format</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=INX_extension_descriptor_format&amp;diff=14431"/>
		<updated>2007-04-26T16:48:02Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: Added page, notebook and enum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
&lt;br /&gt;
In order for Inkscape to make use of an external script or program, you must describe that script to inkscape using an INX file. See the inkscape share directory for examples. The INX file allows the author to:&lt;br /&gt;
* label strings for translation &lt;br /&gt;
* define parameters&lt;br /&gt;
* chain extensions&lt;br /&gt;
* etc&lt;br /&gt;
Be sure to read through the INX files that come with Inkscape. Nothing beats a working example.&lt;br /&gt;
&lt;br /&gt;
== Localisation of extensions ==&lt;br /&gt;
&lt;br /&gt;
To allow localisation of strings in extension for Inkscape, some xml tags have to be adapted to variant readable by intltool. It means that tags or parametres has to have &amp;quot;_&amp;quot; prepended to their name, e.g. &amp;lt;_name&amp;gt;name of extension&amp;lt;/_name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also the path to the extension has to be included in POTFILES.in file to tell intltool where to look for translatable content.&lt;br /&gt;
&lt;br /&gt;
Usefull information, before this section gets fully updated, can be found at [http://gould.cx/ted/blog/Translating_Custom_XML Ted's blog].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
More example INX files are available in the Inkscape distribution or in the Inkscape [http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/|SVN repository].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;inkscape-extension&amp;gt;&lt;br /&gt;
  &amp;lt;_name&amp;gt;{Friendly Extension Name}&amp;lt;/_name&amp;gt;&lt;br /&gt;
  &amp;lt;id&amp;gt;{org.domain.sub-domain.extension-name}&amp;lt;/id&amp;gt;&lt;br /&gt;
  &amp;lt;dependency type=&amp;quot;executable&amp;quot; location=&amp;quot;[extensions|path|plugins|{location}]&amp;quot;&amp;gt;program.ext&amp;lt;/dependency&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;tab&amp;quot; type=&amp;quot;notebook&amp;quot;&amp;gt;  &lt;br /&gt;
    &amp;lt;page name=&amp;quot;controls&amp;quot; _gui-text=&amp;quot;Controls&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;param name=&amp;quot;{argumentName}&amp;quot; type=&amp;quot;[int|float|string|boolean|description]&amp;quot; min=&amp;quot;{number}&amp;quot; max=&amp;quot;{number}&amp;quot;&lt;br /&gt;
        _gui-text=&amp;quot;{Friendly Argument Name}&amp;quot;&amp;gt;{default value}&amp;lt;/param&amp;gt;&lt;br /&gt;
    &amp;lt;/page&amp;gt;&lt;br /&gt;
    &amp;lt;page name=&amp;quot;help&amp;quot; _gui-text=&amp;quot;Help&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;param name=&amp;quot;help_text&amp;quot; type=&amp;quot;description&amp;quot;&amp;gt;{Friendly Extension Help}&amp;lt;/param&amp;gt;&lt;br /&gt;
    &amp;lt;/page&amp;gt;&lt;br /&gt;
  &amp;lt;/param&amp;gt;&lt;br /&gt;
  &amp;lt;effect&amp;gt;&lt;br /&gt;
    &amp;lt;object-type&amp;gt;[all|{element type}]&amp;lt;/object-type&amp;gt;&lt;br /&gt;
      &amp;lt;effects-menu&amp;gt;&lt;br /&gt;
        &amp;lt;submenu _name=&amp;quot;{Extension Group Name}&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/effects-menu&amp;gt;&lt;br /&gt;
  &amp;lt;/effect&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;command reldir=&amp;quot;extensions&amp;quot; interpreter=&amp;quot;[python|perl|ruby|bash|{some other}]&amp;quot;&amp;gt;program.ext&amp;lt;/command&amp;gt;&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/inkscape-extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== DTD ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT inkscape-extension (name, id, dependency*, param*,(input|output|effect),(script|plugin))&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT input (extension, mimetype, filetype, filetypetooltip, output_extension?)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT output (extension, mimetype, filetype, filetypetooltip, dataloss?)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT effect (object-type)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT script (command, helper_extension*, check*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT plugin (name)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT name (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT id (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT dependency (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT param (#PCDATA, page*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT page (#PCDATA, param*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT extension (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT mimetype (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT filetype (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT filetooltip (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT object-type (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT command (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT check (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT dataloss (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT helper_extension (#PCDATA)&amp;gt;&lt;br /&gt;
 &amp;lt;!ELEMENT output_extension (#PCDATA)&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;!ATTLIST check reldir (absolute|path|extensions|plugins) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST command reldir (absolute|path|extensions|plugins) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST command interpreter CDATA #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST dependency type (executable|extension) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST dependency location (absolute|path|extensions|plugins) #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST dependency description CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST page name CDATA #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST page gui-text CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param name CDATA #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param type (int|float|string|boolean|enum|notebook|description) #REQUIRED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param min CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param max CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST param gui-text CDATA #IMPLIED&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST submenu name CDATA #REQUIRED&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[[ScriptingHOWTO]]&lt;br /&gt;
*[http://sourceforge.net/mailarchive/message.php?msg_id=11420660|Aaron's message] from the developer list with an initial DTD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer Documentation]]&lt;br /&gt;
[[Category:Help Wanted]]&lt;br /&gt;
[[Category:Extensions]]&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=PythonEffectTutorial&amp;diff=14429</id>
		<title>PythonEffectTutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=PythonEffectTutorial&amp;diff=14429"/>
		<updated>2007-04-26T12:32:06Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: parseLenght removed and complete source code added.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Effect extensions in Inkscape means a simple programs or scripts that reads input SVG file transforms it somehow and prints it to the standart output.&lt;br /&gt;
&lt;br /&gt;
We will write simple effect extension script in Python that will put &amp;quot;Hello World!&amp;quot; or &amp;quot;Hello &amp;lt;value of --what option&amp;gt;!&amp;quot; string in the center of document and inside a new layer.&lt;br /&gt;
&lt;br /&gt;
== Effect Extension Script ==&lt;br /&gt;
&lt;br /&gt;
First of all create file ''hello_world.py'' and make them executable with Python interpreter with well-known directive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import ''inkex.py'' file with ''Effect'' base class that will do most of work for us and ''simplestyle.py'' module with support functions for working with CSS styles. We will use just ''formatStyle'' function from this module:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import inkex&lt;br /&gt;
from simplestyle import *&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Declare ''HelloWordEffect'' class and write a constructor where base class is initialized and script option for opition parser is defined:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class HelloWorldEffect(inkex.Effect):&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
        inkex.Effect.__init__(self)&lt;br /&gt;
        self.OptionParser.add_option('-w', '--what', action = 'store',&lt;br /&gt;
          type = 'string', dest = 'what', default = 'World',&lt;br /&gt;
          help = 'What would you like to greet?')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete documentation for ''OptionParser'' class can be found at http://docs.python.org/lib/module-optparse.html. Here we just use ''add_option'' method which has as first argument short option name, as second argument long option name and then a few other arguments with this meaning:&lt;br /&gt;
&lt;br /&gt;
* ''action'' - An action which should be done with option value. In this case we use action ''store'' which will store option value in ''self.options.&amp;lt;destination&amp;gt;'' attribute.&lt;br /&gt;
* ''type'' - Type of option value. We use string here.&lt;br /&gt;
* ''dest'' - Destination of option action specified by ''action'' argument. Using ''what'' value we say that we want to store option value to self.options.what attribute.&lt;br /&gt;
* ''default'' - Defalut value for this option if it is not specified.&lt;br /&gt;
* ''help'' - A help string that will be displayed if script will be given no arguments or some option or argument will have wrong syntax.&lt;br /&gt;
&lt;br /&gt;
Inkscape will create a GUI form with widgets for all specified options and prefill them with specified default values using ''.inx''. file for this extenstion which we will write later. &lt;br /&gt;
&lt;br /&gt;
We need to override only one ''Effect'' class method to provide effect functionality: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def effect(self):&lt;br /&gt;
        what = self.options.what&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can mention we just stored ''--what'' option value to ''what'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we will finally start to do something. We will work with XML representation of SVG document via ''self.document'' attribute. It is of ''Document'' class type from ''xml.dom'' module. Complete documentation for this module can be found at http://docs.python.org/lib/module-xml.dom.html.&lt;br /&gt;
&lt;br /&gt;
First get SVG document ''svg'' element and its dimensions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        svg = self.document.getElementsByTagName('svg')[0]&lt;br /&gt;
        width = inkex.unittouu(svg.getAttribute('width'))&lt;br /&gt;
        height = inkex.unittouu(svg.getAttribute('height'))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Function ''getElementsByTagName'' returns list of all found elements of this name so we just use first of them.&lt;br /&gt;
&lt;br /&gt;
Create SVG group element and &amp;quot;convert&amp;quot; it to layer using Inkscape SVG extenstions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        layer = self.document.createElement('g')&lt;br /&gt;
        layer.setAttribute('inkscape:label', 'Hello %s Layer' % (what))&lt;br /&gt;
        layer.setAttribute('inkscape:groupmode', 'layer')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create SVG text element and its value containing &amp;quot;Hello World&amp;quot;&amp;quot; string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        text = self.document.createElement('text')&lt;br /&gt;
        value = self.document.createTextNode('Hello %s!' % (what))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set position of text to center of SVG document:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        text.setAttribute('x', str(width / 2))&lt;br /&gt;
        text.setAttribute('y', str(height  / 2))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we want center text on its position we will define CSS style of SVG ''text'' element. Actually use ''text-anchor'' SVG extension to CSS styles to do that work:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        style = {'text-align' : 'center', 'text-anchor' : 'middle'}&lt;br /&gt;
        text.setAttribute('style', formatStyle(style))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally connect all created elements together and put them in SVG document:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        text.appendChild(value)&lt;br /&gt;
        layer.appendChild(text)&lt;br /&gt;
        svg.appendChild(layer)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just defined a class of our effect extension so we have to create an instance of it and execute it in main control flow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
effect = HelloWorldEffect()&lt;br /&gt;
effect.affect()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Extension Description File ==&lt;br /&gt;
&lt;br /&gt;
To include script in Inkscape's main menu create ''hello_world.inx'' file describing script evokation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;inkscape-extension&amp;gt;&lt;br /&gt;
  &amp;lt;_name&amp;gt;Hello World!&amp;lt;/_name&amp;gt;&lt;br /&gt;
  &amp;lt;id&amp;gt;org.ekips.filter.hello_world&amp;lt;/id&amp;gt;&lt;br /&gt;
  &amp;lt;dependency type=&amp;quot;executable&amp;quot; location=&amp;quot;extensions&amp;quot;&amp;gt;hello_world.py&amp;lt;/dependency&amp;gt;&lt;br /&gt;
  &amp;lt;dependency type=&amp;quot;executable&amp;quot; location=&amp;quot;extensions&amp;quot;&amp;gt;inkex.py&amp;lt;/dependency&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;what&amp;quot; type=&amp;quot;string&amp;quot; _gui-text=&amp;quot;What would you like to greet?&amp;quot;&amp;gt;World&amp;lt;/param&amp;gt;&lt;br /&gt;
  &amp;lt;effect&amp;gt;&lt;br /&gt;
    &amp;lt;object-type&amp;gt;all&amp;lt;/object-type&amp;gt;&lt;br /&gt;
    &amp;lt;effects-menu&amp;gt;&lt;br /&gt;
       &amp;lt;submenu _name=&amp;quot;Examples&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/effects-menu&amp;gt;&lt;br /&gt;
  &amp;lt;/effect&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;command reldir=&amp;quot;extensions&amp;quot; interpreter=&amp;quot;python&amp;quot;&amp;gt;hello_world.py&amp;lt;/command&amp;gt;&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/inkscape-extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create ''&amp;lt;param&amp;gt;'' element for every option of a script and ''&amp;lt;dependency&amp;gt;'' for every included module which is not from Python standard library. Inkscape will search for this modules in directory with script. ''&amp;lt;effect&amp;gt;'' element and its descendants defines name of menu item evoking our new &amp;quot;Hello World!&amp;quot; extension.&lt;br /&gt;
&lt;br /&gt;
If the inx file isn't well formed or if any of the dependencies wasn't met, the extension won't show up in the menu. If your extension doesn't show up, take a look at extension-errors.log, which may give you a hint why it wasn't loaded.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
To install a new extenstion just put ''hello_world.py'' and ''hello_world.inx'' files with all dependency modules  to ''&amp;lt;path_to_inkscape&amp;gt;/extensions'' or ''~/.inkscape/extensions'' directory and start Inkscape. A new menu item ''Hello World!'' in ''Effects-&amp;gt;Examples'' menu should appear.&lt;br /&gt;
&lt;br /&gt;
== Complete Source Code ==&lt;br /&gt;
&lt;br /&gt;
Here is a complete commented source pre of ''hello_world.py'' script file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
# We will use inex module with predefined effect base class.&lt;br /&gt;
import inkex&lt;br /&gt;
 # simplestyle module provides functions for style parsing.&lt;br /&gt;
from simplestyle import *&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot; Example Inkscape effect extension.&lt;br /&gt;
Creates a new layer with &amp;quot;Hello World!&amp;quot; text centered in middle of document.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
class HelloWorldEffect(inkex.Effect):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; Constructor.&lt;br /&gt;
    Defines &amp;quot;--what&amp;quot; option of a script.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
        # Call base class construtor.&lt;br /&gt;
        inkex.Effect.__init__(self)&lt;br /&gt;
&lt;br /&gt;
        # Define string option &amp;quot;--what&amp;quot; with &amp;quot;-w&amp;quot; shortcut and default value &amp;quot;World&amp;quot;.&lt;br /&gt;
        self.OptionParser.add_option('-w', '--what', action = 'store',&lt;br /&gt;
          type = 'string', dest = 'what', default = 'World',&lt;br /&gt;
          help = 'What would you like to greet?')&lt;br /&gt;
&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; Effect behaviour.&lt;br /&gt;
    Overrides base class' method and insert &amp;quot;Hello World&amp;quot; text in SVG document. &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    def effect(self):&lt;br /&gt;
        # Get script &amp;quot;--what&amp;quot; option value.&lt;br /&gt;
        what = self.options.what&lt;br /&gt;
&lt;br /&gt;
        # Get access to main SVG document element and get its dimensions.&lt;br /&gt;
        svg = self.document.getElementsByTagName('svg')[0]&lt;br /&gt;
        width = inkex.unittouu(svg.getAttribute('width'))&lt;br /&gt;
        height = inkex.unittouu(svg.getAttribute('height'))&lt;br /&gt;
&lt;br /&gt;
        # Create a new layer.&lt;br /&gt;
        layer = self.document.createElement('g')&lt;br /&gt;
        layer.setAttribute('inkscape:label', 'Hello %s Layer' % (what))&lt;br /&gt;
        layer.setAttribute('inkscape:groupmode', 'layer')&lt;br /&gt;
&lt;br /&gt;
        # Create text element&lt;br /&gt;
        text = self.document.createElement('text')&lt;br /&gt;
        value = self.document.createTextNode('Hello %s!' % (what))&lt;br /&gt;
&lt;br /&gt;
        # Set text position to center of document.&lt;br /&gt;
        text.setAttribute('x', str(width / 2))&lt;br /&gt;
        text.setAttribute('y', str(height  / 2))&lt;br /&gt;
&lt;br /&gt;
        # Center text horizontally with CSS style.&lt;br /&gt;
        style = {'text-align' : 'center', 'text-anchor': 'middle'}&lt;br /&gt;
        text.setAttribute('style', formatStyle(style))&lt;br /&gt;
&lt;br /&gt;
        # Connect elements together.&lt;br /&gt;
        text.appendChild(value)&lt;br /&gt;
        layer.appendChild(text)&lt;br /&gt;
        svg.appendChild(layer)&lt;br /&gt;
&lt;br /&gt;
# Create effect instance and apply it.&lt;br /&gt;
effect = HelloWorldEffect()&lt;br /&gt;
effect.affect()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[User:Blackhex|Blackhex]] 11:59, 26 April 2007 (UTC)&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=PythonEffectTutorial&amp;diff=14425</id>
		<title>PythonEffectTutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=PythonEffectTutorial&amp;diff=14425"/>
		<updated>2007-04-26T11:59:40Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: Initial page content.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Effect extensions in Inkscape means a simple programs or scripts that reads input SVG file transforms it somehow and prints it to the standart output.&lt;br /&gt;
&lt;br /&gt;
We will write simple effect extension script in Python that will put &amp;quot;Hello World!&amp;quot; or &amp;quot;Hello &amp;lt;value of option&amp;gt;!&amp;quot; string in the center of document and inside a new layer.&lt;br /&gt;
&lt;br /&gt;
== Effect Extension Script ==&lt;br /&gt;
&lt;br /&gt;
First of all create file ''hello_world.py'' and make them executable with Python interpreter with well-known directive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import ''inkex.py'' file with ''Effect'' base class that will do most of work for us and ''simplestyle.py'' module with support functions for working with CSS styles. We will use just ''formatStyle'' function from this module:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import inkex&lt;br /&gt;
from simplestyle import *&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Declare ''HelloWordEffect'' class and write a constructor where base class is initialized and script option for opition parser is defined:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class HelloWorldEffect(inkex.Effect):&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
        inkex.Effect.__init__(self)&lt;br /&gt;
        self.OptionParser.add_option('-w', '--what', action = 'store',&lt;br /&gt;
          type = 'string', dest = 'what', default = 'World',&lt;br /&gt;
          help = 'What would you like to greet?')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete documentation for ''OptionParser'' class can be found at http://docs.python.org/lib/module-optparse.html. Here we just use ''add_option'' method which has as first argument short option name, as second argument long option name and then a few other arguments with this meaning:&lt;br /&gt;
&lt;br /&gt;
* ''action'' - An action which should be done with option value. In this case we use action ''store'' which will store option value in ''self.options.&amp;lt;destination&amp;gt;'' attribute.&lt;br /&gt;
* ''type'' - Type of option value. We use string here.&lt;br /&gt;
* ''dest'' - Destination of option action specified by ''action'' argument. Using ''what'' value we say that we want to store option value to self.options.what attribute.&lt;br /&gt;
* ''default'' - Defalut value for this option if it is not specified.&lt;br /&gt;
* ''help'' - A help string that will be displayed if script will be given no arguments or some option or argument will have wrong syntax.&lt;br /&gt;
&lt;br /&gt;
Inkscape will create a GUI form with widgets for all specified options and prefill them with specified default values using ''.inx''. file for this extenstion which we will write later. &lt;br /&gt;
&lt;br /&gt;
We need to override only one ''Effect'' class method to provide effect functionality: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    def effect(self):&lt;br /&gt;
        what = self.options.what&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can mention we just stored ''--what'' option value to ''what'' variable.&lt;br /&gt;
&lt;br /&gt;
Now we will finally start to do something. We will work with XML representation of SVG document via ''self.document'' attribute. It is of ''Document'' class type from ''xml.dom'' module. Complete documentation for this module can be found at http://docs.python.org/lib/module-xml.dom.html.&lt;br /&gt;
&lt;br /&gt;
First get SVG document ''svg'' element and its dimensions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        svg = self.document.getElementsByTagName('svg')[0]&lt;br /&gt;
        width = parseLength(svg.getAttribute('width'))[0]&lt;br /&gt;
        height = parseLength(svg.getAttribute('height'))[0]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Function ''getElementsByTagName'' returns list of all found elements of this name so we just use first of them.&lt;br /&gt;
&lt;br /&gt;
We used ''parseLength'' function which returns tuple with float value and string with unit from its parameter containg CSS lenght type value (for example: 10px, 10pt, 10, 10cm, ...). Function will be defined later.&lt;br /&gt;
&lt;br /&gt;
Create SVG group element and &amp;quot;convert&amp;quot; it to layer using Inkscape SVG extenstions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        layer = self.document.createElement('g')&lt;br /&gt;
        layer.setAttribute('inkscape:label', 'Hello %s Layer' % (what))&lt;br /&gt;
        layer.setAttribute('inkscape:groupmode', 'layer')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create SVG text element and its value containing &amp;quot;Hello World&amp;quot;&amp;quot; string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        text = self.document.createElement('text')&lt;br /&gt;
        value = self.document.createTextNode('Hello %s!' % (what))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set position of text to center of SVG document:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        text.setAttribute('x', str(width / 2))&lt;br /&gt;
        text.setAttribute('y', str(height  / 2))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we want center text on its position we will define CSS style of SVG ''text'' element. Actually use ''text-anchor'' SVG extension to CSS styles to do that work:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        style = {'text-align' : 'center', 'text-anchor' : 'middle'}&lt;br /&gt;
        text.setAttribute('style', formatStyle(style))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally connect all created elements together and put them in SVG document:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        text.appendChild(value)&lt;br /&gt;
        layer.appendChild(text)&lt;br /&gt;
        svg.appendChild(layer)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just defined a class of our effect extension so we have to create an instance of it and execute it in main control flow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
effect = HelloWorldEffect()&lt;br /&gt;
effect.affect()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As mentioned before we need to define ''parseLength'' function. Probably this kind of function and other similar should be a part of a new support module for extensions creating:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def parseLength(length):&lt;br /&gt;
    if len(length) &amp;gt;= 1:&lt;br /&gt;
        if length[-1:] == '%':&lt;br /&gt;
            return (float(length[:-1]), length[-1:])&lt;br /&gt;
    if len(length) &amp;gt;= 2:&lt;br /&gt;
        if length[-2:] in ('px', 'pt', 'em', 'cm', 'mm'):&lt;br /&gt;
            return (float(length[:-2]), length[-2:])&lt;br /&gt;
    return (float(length), '')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Extension Description File ==&lt;br /&gt;
&lt;br /&gt;
To include script in Inkscape's main menu create ''hello_world.inx'' file describing script evokation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;inkscape-extension&amp;gt;&lt;br /&gt;
  &amp;lt;_name&amp;gt;Hello World!&amp;lt;/_name&amp;gt;&lt;br /&gt;
  &amp;lt;id&amp;gt;org.ekips.filter.hello_world&amp;lt;/id&amp;gt;&lt;br /&gt;
  &amp;lt;dependency type=&amp;quot;executable&amp;quot; location=&amp;quot;extensions&amp;quot;&amp;gt;hello_world.py&amp;lt;/dependency&amp;gt;&lt;br /&gt;
  &amp;lt;dependency type=&amp;quot;executable&amp;quot; location=&amp;quot;extensions&amp;quot;&amp;gt;inkex.py&amp;lt;/dependency&amp;gt;&lt;br /&gt;
  &amp;lt;param name=&amp;quot;what&amp;quot; type=&amp;quot;string&amp;quot; _gui-text=&amp;quot;What would you like to greet?&amp;quot;&amp;gt;World&amp;lt;/param&amp;gt;&lt;br /&gt;
  &amp;lt;effect&amp;gt;&lt;br /&gt;
    &amp;lt;object-type&amp;gt;all&amp;lt;/object-type&amp;gt;&lt;br /&gt;
    &amp;lt;effects-menu&amp;gt;&lt;br /&gt;
       &amp;lt;submenu _name=&amp;quot;Examples&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/effects-menu&amp;gt;&lt;br /&gt;
  &amp;lt;/effect&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;command reldir=&amp;quot;extensions&amp;quot; interpreter=&amp;quot;python&amp;quot;&amp;gt;hello_world.py&amp;lt;/command&amp;gt;&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/inkscape-extension&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create ''&amp;lt;param&amp;gt;'' element for every option of a script and ''&amp;lt;dependency&amp;gt;'' for every included module which is not from Python standard library. Inkscape will search for this modules in directory with script. ''&amp;lt;effect&amp;gt;'' element and its descendants defines name of menu item evoking our new &amp;quot;Hello World!&amp;quot; extension.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
To install a new extenstion just put ''hello_world.py'' and ''hello_world.inx'' files with all dependency modules  to ''&amp;lt;path_to_inkscape&amp;gt;/extensions'' or ''~/.inkscape/extensions'' directory and start Inkscape. A new menu item ''Hello World!'' in ''Effects-&amp;gt;Examples'' menu should appear.&lt;br /&gt;
&lt;br /&gt;
[[User:Blackhex|Blackhex]] 11:59, 26 April 2007 (UTC)&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
	<entry>
		<id>https://wiki.inkscape.org/wiki/index.php?title=PythonEffectTutorial&amp;diff=14421</id>
		<title>PythonEffectTutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.inkscape.org/wiki/index.php?title=PythonEffectTutorial&amp;diff=14421"/>
		<updated>2007-04-25T21:34:53Z</updated>

		<summary type="html">&lt;p&gt;Blackhex: Just creating a page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here will be tutorial about making a new Inkscape effects in Python.&lt;/div&gt;</summary>
		<author><name>Blackhex</name></author>
	</entry>
</feed>