David Nečas
Sat, 14 Jan 2012 05:17:06 -0800
On Sat, Jan 14, 2012 at 12:34:10PM +0000, Neil Munro wrote: > I was wondering if it is possible to remove a tool item from a > toolbar instantly,
=================================================
from gi.repository import Gtk
def modify(b, t):
if t.get_n_items() == 1:
b.set_stock_id(Gtk.STOCK_REMOVE)
b2 = Gtk.ToolButton.new_from_stock(Gtk.STOCK_HELP)
b2.show_all()
t.insert(b2, 1)
else:
b.set_stock_id(Gtk.STOCK_ADD)
t.get_nth_item(1).destroy()
print t.get_n_items()
w = Gtk.Window()
w.connect('destroy', Gtk.main_quit)
w.set_default_size(200,40)
t = Gtk.Toolbar()
w.add(t)
b = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ADD)
b.connect('clicked', modify, t)
t.insert(b, 0)
w.show_all()
Gtk.main()
=================================================
> I have tried
> to destroy the widget but it still works, am I missing something
Yes. Hard to tell what.
Yeti
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list