<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>paulocabido.com &#187; python</title>
	<atom:link href="http://www.paulocabido.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paulocabido.com</link>
	<description>I do all my own stunts!</description>
	<lastBuildDate>Mon, 06 Feb 2012 00:32:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>pygtk + toolbar + toolbutton with custom image</title>
		<link>http://www.paulocabido.com/python/pygtk-toolbar-toolbutton-with-custom-image/</link>
		<comments>http://www.paulocabido.com/python/pygtk-toolbar-toolbutton-with-custom-image/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 10:15:01 +0000</pubDate>
		<dc:creator>pcabido</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[EN]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[pygtk]]></category>
		<category><![CDATA[toolbar]]></category>
		<category><![CDATA[toolbutton]]></category>

		<guid isPermaLink="false">http://www.paulocabido.com/?p=152</guid>
		<description><![CDATA[Last night I had more trouble than I was expecting while trying to put a custom image on a toolbar button. I had already done this with tabs, normal buttons and solo. It was easy but for the toolbutton it wasn&#8217;t so obvious&#8230; maybe it was because of the hour, I don&#8217;t know. So here [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I had more trouble than I was expecting while trying to put a custom image on a toolbar button. I had already done this with tabs, normal buttons and solo. It was easy but for the toolbutton it wasn&#8217;t so obvious&#8230; maybe it was because of the hour, I don&#8217;t know.<br />
So here goes a sample to help any one in need:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># create the pixbuf with the image and it's size.</span>
<span style="color: #808080; font-style: italic;"># 24,24 is the TaskEditor's toolbar icon size</span>
<span style="color: #808080; font-style: italic;"># the path gets the current document path to use with the image</span>
path = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">dirname</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">abspath</span><span style="color: black;">&#40;</span>__file__<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
icon_path = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>path, <span style="color: #483d8b;">&quot;image.png&quot;</span><span style="color: black;">&#41;</span>
pixbuf = gtk.<span style="color: black;">gdk</span>.<span style="color: black;">pixbuf_new_from_file_at_size</span><span style="color: black;">&#40;</span>icon_path , <span style="color: #ff4500;">24</span>, <span style="color: #ff4500;">24</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># create the image and associate the pixbuf</span>
image = gtk.<span style="color: black;">Image</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
image.<span style="color: black;">set_from_pixbuf</span><span style="color: black;">&#40;</span>pixbuf<span style="color: black;">&#41;</span>
image.<span style="color: black;">show</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># create the toolbutton</span>
btn = gtk.<span style="color: black;">ToolButton</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
btn.<span style="color: black;">set_icon_widget</span><span style="color: black;">&#40;</span>image<span style="color: black;">&#41;</span>
btn.<span style="color: black;">set_label</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Task location&quot;</span><span style="color: black;">&#41;</span>
btn.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'clicked'</span>, <span style="color: #008000;">self</span>.<span style="color: black;">some_method</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># then just add the item (btn) to the position you want</span>
toolbar.<span style="color: black;">insert</span><span style="color: black;">&#40;</span>btn, position<span style="color: black;">&#41;</span>
btn.<span style="color: black;">show</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>That&#8217;s all! <img src='http://www.paulocabido.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=paulocabido.com&link=http%3A%2F%2Fwww.paulocabido.com%2Fpython%2Fpygtk-toolbar-toolbutton-with-custom-image%2F&title=pygtk+%2B+toolbar+%2B+toolbutton+with+custom+image&desc=Last+night+I+had+more+trouble+than+I+was+expecting+while+trying+to+put+a+custom+image+on+a+toolbar+button.+I+had+already+done+this+with+tabs%2C+normal+buttons+and+solo.+It+was+easy+but+for+the+toolbutto&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>]]></content:encoded>
			<wfw:commentRss>http://www.paulocabido.com/python/pygtk-toolbar-toolbutton-with-custom-image/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Summer of Code: Week 3</title>
		<link>http://www.paulocabido.com/gsoc/google-summer-of-code-week-3/</link>
		<comments>http://www.paulocabido.com/gsoc/google-summer-of-code-week-3/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 19:05:01 +0000</pubDate>
		<dc:creator>pcabido</dc:creator>
				<category><![CDATA[gnome]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[EN]]></category>
		<category><![CDATA[getting things gnome]]></category>
		<category><![CDATA[plug-in]]></category>

		<guid isPermaLink="false">http://www.paulocabido.com/?p=87</guid>
		<description><![CDATA[On week three I accomplished an important part of the project, that was to have by the end of the week a &#8220;working prototype&#8221; of the plug-in engine. Its not complete but the difficult part and the part where I was (very) confused is done. Plug-ins are loading and working. Briefly, the system is divided [...]]]></description>
			<content:encoded><![CDATA[<p>On week three I accomplished an important part of the project, that was to have by the end of the week a &#8220;working prototype&#8221; of the plug-in engine. Its not complete but the difficult part and the part where I was (very) confused is done.<br />
Plug-ins are loading and working. Briefly, the system is divided into three parts:</p>
<ul>
<li>The Plugin Manager that handles the GUI for the plug-ins</li>
<li>The Plugin Engine that handles the load, initialization, activation, etc for the plug-ins</li>
<li>A third part that is the plug-in API (the methods that are allowed for a plug-in to use)</li>
</ul>
<p>
And for the screen shot lovers here are some images of what is done:<br />
<br />
<a href="http://www.paulocabido.com/wp-content/uploads/2009/06/Plugin_GUI.png" rel="prettyPhoto[87]" rel="lightbox[87]"><img src="http://www.paulocabido.com/wp-content/uploads/2009/06/Plugin_GUI-300x235.png" alt="Plugin_GUI" title="Plugin_GUI" width="300" height="235" class="aligncenter size-medium wp-image-89" /></a><br />
<a href="http://www.paulocabido.com/wp-content/uploads/2009/06/Plugin_working.png" rel="prettyPhoto[87]" rel="lightbox[87]"><img src="http://www.paulocabido.com/wp-content/uploads/2009/06/Plugin_working-300x133.png" alt="Plugin_working" title="Plugin_working" width="300" height="133" class="aligncenter size-medium wp-image-90" /></a><br />
<br />
The first screen shot is obvious, it&#8217;s the Plug-in Manager GUI and the second screen shot is the features that the plug-ins are implementing. The plug-ins are copys of each other, the each add a menu to the Plug-in menu on the menu bar and by clicking that menu you can see the action on the gnome-terminal and the last two buttons on the ToolBar are also put there by the plug-ins (you can also see the output on the gnome-terminal that resulted by a click on a button). New screen shots or maybe a video next week!<br />
<br />
For week 4 I have the intention to finish the plug-in engine, it will be a work in progress but I want to finish all the main parts, and start the geoclue-python module that I will later use with a plug-in in GTG!.<br />
<br />
Besides this I will continue my university marathon, here in Portugal the professors seam to wait for each other and set the tasks we have to do all at the same time. I still have 3 exams and 4 assignments to submit during June.</p>
<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=paulocabido.com&link=http%3A%2F%2Fwww.paulocabido.com%2Fgsoc%2Fgoogle-summer-of-code-week-3%2F&title=Google+Summer+of+Code%3A+Week+3&desc=On+week+three+I+accomplished+an+important+part+of+the+project%2C+that+was+to+have+by+the+end+of+the+week+a+%22working+prototype%22+of+the+plug-in+engine.+Its+not+complete+but+the+difficult+part+and+the+part&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>]]></content:encoded>
			<wfw:commentRss>http://www.paulocabido.com/gsoc/google-summer-of-code-week-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>geoclue &#8211; example3</title>
		<link>http://www.paulocabido.com/gsoc/geoclue-example3/</link>
		<comments>http://www.paulocabido.com/gsoc/geoclue-example3/#comments</comments>
		<pubDate>Wed, 27 May 2009 14:03:40 +0000</pubDate>
		<dc:creator>pcabido</dc:creator>
				<category><![CDATA[geoclue]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[d-bus]]></category>
		<category><![CDATA[EN]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.paulocabido.com/?p=71</guid>
		<description><![CDATA[I uploaded today the third example of how to use geoclue thru python/d-bus. All the examples are available here.]]></description>
			<content:encoded><![CDATA[<p>I uploaded today the third example of how to use <a href="http://www.freedesktop.org/wiki/Software/GeoClue">geoclue</a> thru python/d-bus. All the examples are available <a href="http://paulocabido.com/soc/geoclue-examples/">here</a>.</p>
<div style="padding-top:5px;padding-right:0px;padding-bottom:5px;padding-left:0px;;">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=paulocabido.com&link=http%3A%2F%2Fwww.paulocabido.com%2Fgsoc%2Fgeoclue-example3%2F&title=geoclue+-+example3&desc=I+uploaded+today+the+third+example+of+how+to+use+geoclue+thru+python%2Fd-bus.+All+the+examples+are+available+here.&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div>]]></content:encoded>
			<wfw:commentRss>http://www.paulocabido.com/gsoc/geoclue-example3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

