I can't figure out how to set stock items in pygtk-1.99.7. I'm attaching
a small test code, but it crashes with the error:

Traceback (most recent call last):
  File "./test.py", line 37, in ?
    if __name__ == "__main__": main()
  File "./test.py", line 34, in main
    app = run_app()
  File "./test.py", line 15, in run_app
    gtk.stock_add( ("cake", "Cake", gtk.gdk.CONTROL_MASK, ord( "c"),
"uk"))
TypeError: items sequence members must be of form (stock_id, label,
modifiers, keyval, domain)

Can someone tell me what I'm doing wrong?

Thanks,

Edgar.


import gtk
import install

def run_app():
    pixbuf = gtk.gdk.pixbuf_new_from_file( install.dir +
        "/pixmaps/cake.png")

    iconset = gtk.IconSet( pixbuf)
    iconfactory = gtk.IconFactory()
    iconfactory.add( "cake", iconset)
    iconfactory.add_default()

    gtk.stock_add( ("cake", "Cake", gtk.gdk.CONTROL_MASK, ord( "c"),
"uk"))

    vbox = gtk.VBox()

    image = gtk.Image()
    image.set_from_stock( "cake", gtk.ICON_SIZE_LARGE_TOOLBAR)
    vbox.pack_start( image, gtk.FALSE, gtk.FALSE, 0)

    button = gtk.Button( stock="cake")
    vbox.pack_start( button, gtk.FALSE, gtk.FALSE, 0)

    win = gtk.Window()
    win.add( vbox)
    win.show_all()

    win.connect( "destroy", lambda w: gtk.main_quit())


def main():
    app = run_app()
    gtk.mainloop()

if __name__ == "__main__": main()



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to