Thomas Mills Hinkle wrote:
On Tue, 09 Nov 2004 10:01:30 +0000 Stuart Hughes <[EMAIL PROTECTED]> wrote:
Hi,
I've been pulling my hair out trying to get tooltips to work within a toolbutton.
I'm using glade-2 (2.6.5), libglade-2.3.6, pygtk-2.4.0, and python 2.3.4
I've attached a simple test case that shows a normal button's tooltip works, but a toolbutton's doesn't.
Has anyone got an idea what's wrong.
This isn't a whole lot of help, but I've created & attached a simple
test case w/o glade which confirms that glade is not the problem.
You have to set the tooltip for a ToolItem using:
http://www.pygtk.org/pygtk2reference/class-gtktoolitem.html#method-gtktoolitem--set-tooltip
Use an Action with an accelerator and create the ToolItem from the Action. With the UIManager it's pretty easy:
Add it to the list of ToolButton woes... on an off topic note, does
anyone know why ToolBars are designed to work so badly with a keyboard
-- AFAIK there are no mnemonics allowed within a toolbar and tab doesn't
move through widgets in a toolbar correctly. Very frustrating if you
like the big button, attractive look of the toolbar but still want a
keyboard accessible app.
http://www.pygtk.org/pygtk2reference/class-gtkuimanager.html
TIA, StuartTom
------------------------------------------------------------------------
#!/bin/sh """"exec ${PYTHON:-python} -t $0 "$@";" """
import gtk
def main_quit(*args): w.destroy() gtk.main_quit()
tb = gtk.Toolbar() qbutton = gtk.ToolButton(stock_id=gtk.STOCK_QUIT) tb.add(qbutton) qbutton.connect('clicked',main_quit) cbutton = gtk.Button(stock=gtk.STOCK_CANCEL) cbutton.connect('clicked',main_quit) ti = gtk.ToolItem() ti.add(cbutton) tb.add(ti)
# create tooltips manually tt = gtk.Tooltips()
tt.set_tip(qbutton,'quit now')
qbutton.set_tooltip(tt, 'quit now')
tt.set_tip(cbutton,'cancel now') tt.enable() tb.show_all() # connects signal handlers defined in the glade file to actual code w = gtk.Window() w.connect('delete-event',main_quit) w.add(tb) w.show_all()
# mainloop gtk.main()
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
