|
Re: stock item: msg#00074gnome.gtk+.python
Am Donnerstag, den 09.12.2004, 10:05 -0800 schrieb John Finlay: > Marcus Habermehl wrote: > > >Hello. > > > >Short question: How can I register a new stock item? > > > >I found a description how I can register a new item in the > >pygtk2reference. > > > ><from reference> > >gtk.stock_add > > def gtk.stock_add(items) > >items : > >a list or tuple containing 5-tuples > >of stock items > > > >The gtk.stock_add() function registers each of the stock items in the > >list or tuple specified by items. The stock items are specified by a 5- > >tuple containing: > > > > * stock_id - a string identifier > > * label - a string to use for a label > > * modifier - a modifier mask (see the get_state() method for more > > detail on modifiers) > > * keyval - an integer key value (see gtk.gdk.Keymap) Together with > > the modifiers specifies an accelerator. > > * translation_domain - a string identifier of a translation domain > > > >If an item already exists with the same stock ID as one of the items, > >the old item gets replaced. > ></from reference> > > > >And this is my test. > > > >event1 = gtk.gdk.Event(gtk.gdk.KEY_PRESS) > >gtk.stock_add(('gtk-current', '_Current', gtk.gdk.Event.get_state(event1), > >99, 'gtk20')) > > > >or > > > >gtk.stock_add(('gtk-current', '_Current', gtk.gdk.Event.get_state > >(gtk.gdk.CONTROL_MASK), 99, 'gtk20')) > > > >But nothing of this is working. > > > >I'am sure that the gtk.stock_add() function is correct. But I think that > >I don't understand gtk.gdk.Event.get_state(). > > > >As you surely can see my English is bad. This is possibly the reason > >wherefore I doesn't understanding gtk.gdk.Event.get_state(). > > > > > > > Your confusion is a result of confusing documentation. The third item in > the 5-tuple should be composed from the Modifier Constants: > http://www.pygtk.org/pygtk2reference/gdk-constants.html#gdk-modifier-constants > to indicate which additional key(s) (if any) should be pressed in > addtion to the keyval key e.g. 'Control' I doesn't understand it. Do you mean I must use anything like this? gtk.stock_add(('gtk-about', '_Credits', gtk.gdk.MOD1_MASK, 113, 'gtk20')) If yes, it doesn't work. regards Marcus _______________________________________________ pygtk mailing list pygtk@xxxxxxxxxx http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: stock item: 00074, Marcus Habermehl |
|---|---|
| Next by Date: | Re: stock item: 00074, Nicolas Roman |
| Previous by Thread: | Re: stock itemi: 00074, John Finlay |
| Next by Thread: | Re: stock item: 00074, Nicolas Roman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |