2007/11/3, Neil Dugan <[EMAIL PROTECTED]>:
Hi Neil,
> I am trying to make an python/gtk+ app. One problem I am having is
> attaching an accelerator to a image button.
>
> This is the code I am using to create the buttons.
>
> --- cut ---
> def index_control(self):
> hbox = gtk.HBox()
> for stock in
> [gtk.STOCK_GOTO_FIRST,gtk.STOCK_GO_BACK,gtk.STOCK_GO_FORWARD,gtk.STOCK_GOTO_LAST]
> :
> image = gtk.Image()
> image.set_from_stock(stock,gtk.ICON_SIZE_MENU)
> button = gtk.Button()
> button.set_image(image)
> hbox.pack_start(button,False,False)
> return hbox
> --- cut ---
> I can give the full source if needed.
I don't see any code with accelerators here, btw here we go with a
small example:
import gtk
w = gtk.Window()
w.connect("destroy", gtk.main_quit)
w.set_default_size(200, 300)
b = gtk.Button(None, gtk.STOCK_QUIT)
b.connect("clicked", gtk.main_quit)
ag = gtk.AccelGroup()
w.add_accel_group(ag)
b.add_accelerator("clicked", ag, ord('q'), gtk.gdk.SHIFT_MASK,
gtk.ACCEL_VISIBLE)
w.add(b)
w.show_all()
gtk.main()
cheers
--
Gian Mario Tagliaretti
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/