[pygtk] How to use gtk.stock_add()
Giuseppe Penone
giuspen at gmail.com
Sun Apr 8 17:49:09 WST 2012
Hi,
ICONPATH = "/usr/share/pixmaps/gksu.png"
factory = Gtk.IconFactory()
pixbuf = GdkPixbuf.Pixbuf.new_from_file(ICONPATH)
iconset = Gtk.IconSet.new_from_pixbuf(pixbuf)
factory.add("gksu", iconset)
factory.add_default()
Cheers,
G.
2012/4/8 Lion Chen <chnlion79 at gmail.com>
> Hello all,
> i want to add my own stock item, so i try the following:
>
> import pygtk
> pygtk.require('2.0')
> import gtk
>
> gtk.stock_add(["STOCK_1", "1", 0, 49, "gtk20") # just a test, 49 is the
> value of "1", i don't want to use any GDK Modifier Constants
> .
> .
> .
> # i want to press "1" to quit , but it doesn't work, when i replace
> gtk.STOCK_1 with gtk.STOCK_QUIT , it can work.
> action = gtk.Action('Quit', "test test test", None, gtk.STOCK_1)
>
> action.connect('activate', self.quit_cb)
>
> quitbutton = gtk.Button()
> .
> .
> .
> action.connect_proxy(quitbutton)
> .
> .
> .
>
>
> when i run it, i got the message:
>
> Traceback (most recent call last):
> File "/home/lionchen/workspace/action/simpleaction.py", line 9, in
> <module>
> gtk.stock_add(("STOCK_1", "_1", gtk.gdk.SHIFT_MASK, 49, "pymserv"))
> TypeError: items sequence members must be of form (stock_id, label,
> modifiers, keyval, domain)
>
> could anybody explain what the domain exactly is? and how do i write the
> correct gtk.stock_add()?
>
> thanks.
>
> Lion
>
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20120408/cd0c7d73/attachment.html>
More information about the pygtk
mailing list