<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kodi.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mbulli</id>
	<title>Official Kodi Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://kodi.wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mbulli"/>
	<link rel="alternate" type="text/html" href="https://kodi.wiki/view/Special:Contributions/Mbulli"/>
	<updated>2026-06-08T20:46:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://kodi.wiki/index.php?title=HOW-TO:HelloWorld_addon&amp;diff=69582</id>
		<title>HOW-TO:HelloWorld addon</title>
		<link rel="alternate" type="text/html" href="https://kodi.wiki/index.php?title=HOW-TO:HelloWorld_addon&amp;diff=69582"/>
		<updated>2014-02-26T22:01:08Z</updated>

		<summary type="html">&lt;p&gt;Mbulli: /* Fixed typo in JSON and replaced single quotes with double quotes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{mininav|[[Development]]|[[Add-on development]]|[[Python development]]|[[Python examples]]}}&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This How To will explain several ways of showing a &amp;quot;Hello World&amp;quot; popup on screen&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
&lt;br /&gt;
==Using xbmc modules==&lt;br /&gt;
&lt;br /&gt;
Simple example using xbmc python modules showing a notification dialog that will show for 5 seconds.&lt;br /&gt;
&lt;br /&gt;
===using build-in functions===&lt;br /&gt;
More info on Built-In functions can be found here: [[List_of_built-in_functions]]&lt;br /&gt;
We will two examples. One with just a simple notification dialog and the other with the same dialog but with using variables.&lt;br /&gt;
It all depends on how extended you scripts will be. Since we require all used strings to be localized (translatable) we recommend the second option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import xbmc&lt;br /&gt;
&lt;br /&gt;
xbmc.executebuiltin(&#039;Notification(Hello World,This is a simple example of notifications,5000,/script.hellow.world.png)&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import xbmc&lt;br /&gt;
import xbmcaddon&lt;br /&gt;
&lt;br /&gt;
__addon__       = xbmcaddon.Addon()&lt;br /&gt;
__addonname__   = __addon__.getAddonInfo(&#039;name&#039;)&lt;br /&gt;
__icon__        = __addon__.getAddonInfo(&#039;icon&#039;)&lt;br /&gt;
 &lt;br /&gt;
line1 = &amp;quot;This is a simple example of notifications&amp;quot;&lt;br /&gt;
time = 5000  #in miliseconds&lt;br /&gt;
 &lt;br /&gt;
xbmc.executebuiltin(&#039;Notification(%s, %s, %d, %s)&#039;%(__addonname__,line1, time, __icon__))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===using xbmcgui module===&lt;br /&gt;
&lt;br /&gt;
This will show a OK dilaog box with the message&lt;br /&gt;
More info on xbmcgui functions can be found here: [ http://mirrors.xbmc.org/docs/python-docs/xbmcgui.html#Dialog ]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import xbmcaddon&lt;br /&gt;
import xbmcgui&lt;br /&gt;
&lt;br /&gt;
__addon__       = xbmcaddon.Addon()&lt;br /&gt;
__addonname__   = __addon__.getAddonInfo(&#039;name&#039;)&lt;br /&gt;
&lt;br /&gt;
line1 = &amp;quot;This is a simple example of OK dialog&amp;quot;&lt;br /&gt;
line2 = &amp;quot;Showing this message using&amp;quot;&lt;br /&gt;
line3 = &amp;quot;XBMC python modules&amp;quot;&lt;br /&gt;
&lt;br /&gt;
xbmcgui.Dialog().ok(__addonname__, line1, line2, line3)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using JSON-RPC==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using xbmc modules &amp;amp; JSON-RPC API==&lt;br /&gt;
&lt;br /&gt;
More info on JSON-RPC API can be found here: [[JSON-RPC_API]]&lt;br /&gt;
&lt;br /&gt;
This JSON-RPC command send through various ways and will execute the addon code that is shown below.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;jsonrpc&amp;quot;: &amp;quot;2.0&amp;quot;,&lt;br /&gt;
    &amp;quot;id&amp;quot;: 0,&lt;br /&gt;
    &amp;quot;method&amp;quot;: &amp;quot;Addons.ExecuteAddon&amp;quot;,&lt;br /&gt;
    &amp;quot;params&amp;quot;: {&lt;br /&gt;
        &amp;quot;addonid&amp;quot;: &amp;quot;script.popup&amp;quot;,&lt;br /&gt;
        &amp;quot;params&amp;quot;: {&lt;br /&gt;
            &amp;quot;image&amp;quot;: &amp;quot;D:\\heartagram.jpg&amp;quot;,&lt;br /&gt;
            &amp;quot;line1&amp;quot;: &amp;quot;Hello World&amp;quot;,&lt;br /&gt;
            &amp;quot;line2&amp;quot;: &amp;quot;Showing this message using&amp;quot;,&lt;br /&gt;
            &amp;quot;line3&amp;quot;: &amp;quot;Combination of XBMC python modules and&amp;quot;,&lt;br /&gt;
            &amp;quot;line4&amp;quot;: &amp;quot;JSON-RPC API interface&amp;quot;,&lt;br /&gt;
            &amp;quot;line5&amp;quot;: &amp;quot;Have fun coding&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This python code will create several controls using xbmcgui module and fill these will the message send through JSON-RPC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import xbmcgui&lt;br /&gt;
import sys&lt;br /&gt;
import urlparse&lt;br /&gt;
&lt;br /&gt;
class PopupWindow(xbmcgui.WindowDialog):&lt;br /&gt;
    def __init__(self, image, line1, line2, line3, line4, line5):&lt;br /&gt;
        self.addControl(xbmcgui.ControlImage(x=25, y=25, width=150, height=150, filename=image[0]))&lt;br /&gt;
        self.addControl(xbmcgui.ControlLabel(x=190, y=25, width=500, height=25, label=line1[0]))&lt;br /&gt;
        self.addControl(xbmcgui.ControlLabel(x=190, y=50, width=500, height=25, label=line2[0]))&lt;br /&gt;
        self.addControl(xbmcgui.ControlLabel(x=190, y=75, width=500, height=25, label=line3[0]))&lt;br /&gt;
        self.addControl(xbmcgui.ControlLabel(x=190, y=100, width=500, height=25, label=line4[0]))&lt;br /&gt;
        self.addControl(xbmcgui.ControlLabel(x=190, y=125, width=500, height=25, label=line5[0]))&lt;br /&gt;
&lt;br /&gt;
if __name__ == &#039;__main__&#039;:&lt;br /&gt;
    params = urlparse.parse_qs(&#039;&amp;amp;&#039;.join(sys.argv[1:]))&lt;br /&gt;
    window = PopupWindow(**params)&lt;br /&gt;
    window.show()&lt;br /&gt;
    xbmc.sleep(5000)&lt;br /&gt;
    window.close()&lt;br /&gt;
    del window&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&#039;&#039;&#039;Development:&#039;&#039;&#039;&lt;br /&gt;
* [[Addon Settings]]&lt;br /&gt;
* [[Python development]]&lt;br /&gt;
* [[Skinning]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Addon Development]]&lt;br /&gt;
[[Category:Python Development]]&lt;/div&gt;</summary>
		<author><name>Mbulli</name></author>
	</entry>
</feed>