pier carteri <[EMAIL PROTECTED]> wrote:
> Hi Francesco,
> probably I didn't undestand you question but:
>
> close_button = gtk.Button(stock =gtk.STOCK_CLOSE )
>
> Is that what you need?
Oh, right, sorry, I neglected to mention the real need: I want to get
the icon from the stock item, but refuse the label (I'm writing an
editor tailored to my needs for an ipaq PDA, so I'm economizing on
pixels...) This is possible if one packs the button in a toolbar, but it
isn't (or at least, I didn't find a simple way to do it) when creating a
simple Button.
Here's a different solution, given to me privately, by somebody from the
list who prefers not to be cited (and you can immediately understand
why...):
b=gtk.Button(stock=gtk.STOCK_OK)
b.get_children()[0].get_children()[0].get_children()[1].set_label('')
Weeeell, probably I'll use this one, since I factorized the code in a
function and this one looks more efficient than calling render_icon and
image.set_from_pixbuf... or does it not?...
Thanks,
Francesco.
> On 7/26/05, Francesco Marchetti-Stasi <[EMAIL PROTECTED]> wrote:
>
>>
>> Well, basically, the subject says it all. I'd just like to add that I'm
>> doing it in a small "command bar", where I have a label, a text entry,
>> and a few buttons laid around, so a Toolbar does not look like a
>> reasonable option.
>>
>> close_button = gtk.Button()
>> pixbuf = close_button.render_icon( gtk.STOCK_CLOSE,
>> gtk.ICON_SIZE_MENU )
>> image = gtk.Image()
>> image.set_from_pixbuf( pixbuf )
>> image.show()
>> close_button.add( image )
>>
>> Still, I could use a Toolbar with a single button inside, and the code
>> wouldn't be much longer, I suppose. Are there other ways to do it? Or is
>> it better to stick with the above code?
>>
>> Thanks,
>> Francesco.
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/