<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Setting a custom label for a Button with stock icon in PyGTK</title>
	<atom:link href="http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/</link>
	<description>Memoirs of a QWERTY Keyboard</description>
	<lastBuildDate>Sat, 21 Jan 2012 16:18:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jordan Callicoat</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-45470</link>
		<dc:creator>Jordan Callicoat</dc:creator>
		<pubDate>Wed, 28 May 2008 03:00:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-45470</guid>
		<description>I believe the &quot;canonical&quot; way of doing this is to create new stock icons and icons sets, something like this:

&lt;code&gt;
stock_items = (
    (&quot;my-gtk-ok&quot;, &quot;_Custom Label&quot;, 0, 0, None),
    (&quot;my-gtk-cancel&quot;, &quot;Custom _Label&quot;, 0, 0, None),
)

stock_aliases = (
    (&quot;my-gtk-ok&quot;, gtk.STOCK_OK),
    (&quot;my-gtk-cancel&quot;, gtk.STOCK_CANCEL),
)

gtk.stock_add(stock_items)

factory = gtk.IconFactory()
factory.add_default()

style = gtk.Style()

for item, alias in stock_aliases:
    icon_set = style.lookup_icon_set(alias)
    factory.add(item, icon_set)

vbox = gtk.VBox()
button = gtk.Button(stock=&quot;my-gtk-ok&quot;)
vbox.pack_start(button)
button = gtk.Button(stock=&quot;my-gtk-cancel&quot;)
vbox.pack_start(button)

...
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I believe the &#8220;canonical&#8221; way of doing this is to create new stock icons and icons sets, something like this:</p>
<p><code><br />
stock_items = (<br />
    ("my-gtk-ok", "_Custom Label", 0, 0, None),<br />
    ("my-gtk-cancel", "Custom _Label", 0, 0, None),<br />
)</p>
<p>stock_aliases = (<br />
    ("my-gtk-ok", gtk.STOCK_OK),<br />
    ("my-gtk-cancel", gtk.STOCK_CANCEL),<br />
)</p>
<p>gtk.stock_add(stock_items)</p>
<p>factory = gtk.IconFactory()<br />
factory.add_default()</p>
<p>style = gtk.Style()</p>
<p>for item, alias in stock_aliases:<br />
    icon_set = style.lookup_icon_set(alias)<br />
    factory.add(item, icon_set)</p>
<p>vbox = gtk.VBox()<br />
button = gtk.Button(stock="my-gtk-ok")<br />
vbox.pack_start(button)<br />
button = gtk.Button(stock="my-gtk-cancel")<br />
vbox.pack_start(button)</p>
<p>...<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harsh</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-24424</link>
		<dc:creator>Harsh</dc:creator>
		<pubDate>Wed, 12 Dec 2007 16:55:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-24424</guid>
		<description>ekinger - Glad it was of help, and thanks for the Menu snippet as well! :)</description>
		<content:encoded><![CDATA[<p>ekinger &#8211; Glad it was of help, and thanks for the Menu snippet as well! <img src='http://www.harshj.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ekingr</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-24423</link>
		<dc:creator>ekingr</dc:creator>
		<pubDate>Wed, 12 Dec 2007 16:47:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-24423</guid>
		<description>Hi,
Thank you very much for this tip !
I&#039;ve spent a long time before finding such post.
I needed it for the ImageMenuItem widget.
For information, it works like this :
&lt;code&gt;
menu=gtk.Menu()
item=gtk.ImageMenuItem(gtk.STOCK_XXX)
item.get_children()[0].set_label(&#039;My _MenuItem&#039;)
menu.append(item)
item.connect(&#039;activate&#039;, method)
item.show()
&lt;/code&gt;
@+</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Thank you very much for this tip !<br />
I&#8217;ve spent a long time before finding such post.<br />
I needed it for the ImageMenuItem widget.<br />
For information, it works like this :<br />
<code><br />
menu=gtk.Menu()<br />
item=gtk.ImageMenuItem(gtk.STOCK_XXX)<br />
item.get_children()[0].set_label('My _MenuItem')<br />
menu.append(item)<br />
item.connect('activate', method)<br />
item.show()<br />
</code><br />
@+</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harsh</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-22336</link>
		<dc:creator>Harsh</dc:creator>
		<pubDate>Thu, 22 Nov 2007 17:23:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-22336</guid>
		<description>I was searching and I think I&#039;d got it through a Softpedia result. &lt;a href=&quot;http://linux.softpedia.com/get/System/Logging/BlueProximity-29875.shtml&quot; rel=&quot;nofollow&quot;&gt;This&lt;/a&gt; page. :)

And thanks for that link, its well written. :]

And yes, VB sure does have its flaws(Agree on the form resizing part, very true!), and its nowhere as powerful as Python either. I&#039;ll try getting into using Glade this week, many thanks for the help and clarification!</description>
		<content:encoded><![CDATA[<p>I was searching and I think I&#8217;d got it through a Softpedia result. <a href="http://linux.softpedia.com/get/System/Logging/BlueProximity-29875.shtml" rel="nofollow">This</a> page. <img src='http://www.harshj.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And thanks for that link, its well written. :]</p>
<p>And yes, VB sure does have its flaws(Agree on the form resizing part, very true!), and its nowhere as powerful as Python either. I&#8217;ll try getting into using Glade this week, many thanks for the help and clarification!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Friedrichs</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-22334</link>
		<dc:creator>Lars Friedrichs</dc:creator>
		<pubDate>Thu, 22 Nov 2007 17:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-22334</guid>
		<description>btw, I used VB (VBA within Access to be exact) earlier too. I believed it to be rather quick and convenient  but I must admit that there are serious issues with that way of designing forms. Try resizing such a form - either it&#039;s not possible or you need very dirty hacks and it&#039;s slow.
Having a layout manager like with gtk or java awt seems a bit strange in the beginning since one is confused where it puts things automatically but one is usually getting used to it fast and afterwards it is very rewarding. You get professional style guis and they are resizable by the user without any hassle.
Layout managers are simply better than an absolute layout - I also learned that the hard way.

Bye
Lars</description>
		<content:encoded><![CDATA[<p>btw, I used VB (VBA within Access to be exact) earlier too. I believed it to be rather quick and convenient  but I must admit that there are serious issues with that way of designing forms. Try resizing such a form &#8211; either it&#8217;s not possible or you need very dirty hacks and it&#8217;s slow.<br />
Having a layout manager like with gtk or java awt seems a bit strange in the beginning since one is confused where it puts things automatically but one is usually getting used to it fast and afterwards it is very rewarding. You get professional style guis and they are resizable by the user without any hassle.<br />
Layout managers are simply better than an absolute layout &#8211; I also learned that the hard way.</p>
<p>Bye<br />
Lars</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Friedrichs</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-22333</link>
		<dc:creator>Lars Friedrichs</dc:creator>
		<pubDate>Thu, 22 Nov 2007 17:00:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-22333</guid>
		<description>It&#039;s funny how small the world seems to be. So you tried my program - may I ask where you downloaded it from? Just for my statistics :-)
Actually I can&#039;t remember exactly where I started at but I believe it was this one:
http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/
Afterwards I mostly used the official docs and google for specific problems.

Bye
Lars</description>
		<content:encoded><![CDATA[<p>It&#8217;s funny how small the world seems to be. So you tried my program &#8211; may I ask where you downloaded it from? Just for my statistics <img src='http://www.harshj.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Actually I can&#8217;t remember exactly where I started at but I believe it was this one:<br />
<a href="http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/" rel="nofollow">http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/</a><br />
Afterwards I mostly used the official docs and google for specific problems.</p>
<p>Bye<br />
Lars</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harsh</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-22320</link>
		<dc:creator>Harsh</dc:creator>
		<pubDate>Thu, 22 Nov 2007 12:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-22320</guid>
		<description>Glad it was of assistance to you :)

I&#039;ve actually used that Bluetooth Proximity thing once, while I was trying out all things possible using my Nokia 6681 + Ubuntu. Nice work indeed, keep it up! :D

I&#039;ve tried using Glade for my PyGTK applications but its just too confusing. I&#039;ve used VB earlier while working on Windows and designing on it was sort of easier and smoother (Being able to place anywhere at will). 

But Glade is very irritating, or maybe am not adding elements into my forms the right way. Do you know of a good tutorial to start Glade with? Cause its painful manually coding in every window element. :(</description>
		<content:encoded><![CDATA[<p>Glad it was of assistance to you <img src='http://www.harshj.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;ve actually used that Bluetooth Proximity thing once, while I was trying out all things possible using my Nokia 6681 + Ubuntu. Nice work indeed, keep it up! <img src='http://www.harshj.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>I&#8217;ve tried using Glade for my PyGTK applications but its just too confusing. I&#8217;ve used VB earlier while working on Windows and designing on it was sort of easier and smoother (Being able to place anywhere at will). </p>
<p>But Glade is very irritating, or maybe am not adding elements into my forms the right way. Do you know of a good tutorial to start Glade with? Cause its painful manually coding in every window element. <img src='http://www.harshj.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lars Friedrichs</title>
		<link>http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/comment-page-1/#comment-22314</link>
		<dc:creator>Lars Friedrichs</dc:creator>
		<pubDate>Thu, 22 Nov 2007 11:04:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.harshj.com/2007/11/17/setting-a-custom-label-for-a-button-with-stock-icon-in-pygtk/#comment-22314</guid>
		<description>Hi there,

thanks for this small advice. It qas quite handy for me since I just had the exact problem of setting a button set by glade but leaving its icon. Just using set_label on the widget itself led to a button with no icon and settings reset.
Your solution has pointed me to the solution that I recheck glade and I see the structure there that the &quot;get_children&quot;-stuff is all about. So now I only reference the label directly and everything is fine.

Thanks,  visit http://blueproximity.sf.net to see the project where this advice was used.

Bye
Lars</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>thanks for this small advice. It qas quite handy for me since I just had the exact problem of setting a button set by glade but leaving its icon. Just using set_label on the widget itself led to a button with no icon and settings reset.<br />
Your solution has pointed me to the solution that I recheck glade and I see the structure there that the &#8220;get_children&#8221;-stuff is all about. So now I only reference the label directly and everything is fine.</p>
<p>Thanks,  visit <a href="http://blueproximity.sf.net" rel="nofollow">http://blueproximity.sf.net</a> to see the project where this advice was used.</p>
<p>Bye<br />
Lars</p>
]]></content:encoded>
	</item>
</channel>
</rss>

