>>>>> "Doug" == Doug Quale <[EMAIL PROTECTED]> writes:

    Doug> People have suggested some ways to do this that work, but I
    Doug> find them a bit hackish.  It's a few more lines of code, but
    Doug> I think it's better to register your own stock icons that
    Doug> reuse images from existing stock items.  This also gives you
    Doug> accelerators and themability.

Nice.  I tried this.  Surprisingly, on my system at least, the icon
for the default gtk.STOCK_CANCEL and my stock hide look different (see
script below), and the stock hide is more primitive (perhaps from an
older GTK)

I don't know if this is a path issue or a problem with the approach.

On my system, the second button in the script below uses a different
icon.

import pygtk
pygtk.require('2.0')
import gtk

items = [
    ('jdh-hide', '_Hide', 0, 0, None),
    ('jdh-auto', '_Auto', 0, 0, None),
         ]

aliases = [
    ('jdh-hide', gtk.STOCK_CANCEL),
    ('jdh-auto', gtk.STOCK_EXECUTE),
           ]

gtk.stock_add(items)

factory = gtk.IconFactory()
factory.add_default()

for new_stock, alias in aliases:
    icon_set = gtk.icon_factory_lookup_default(alias)
    factory.add(new_stock, icon_set)
    


window = gtk.Window()
window.connect("destroy", gtk.mainquit)

vbox = gtk.VBox(spacing=3)
window.add(vbox)
vbox.show()

button = gtk.Button(stock=gtk.STOCK_CANCEL)
button.show()
vbox.pack_start(button)

button = gtk.Button(stock='jdh-hide')
button.show()
vbox.pack_start(button)


button = gtk.Button(stock=gtk.STOCK_CANCEL)
button.show()
alignment = button.get_children()[0]
hbox = alignment.get_children()[0]
image, label = hbox.get_children()
label.set_text('Hide')
vbox.pack_start(button)

window.show()
gtk.mainloop()


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to